@@ -13,7 +13,7 @@ public enum ComboBoxPopupPlacement
1313 {
1414 Undefined ,
1515 Down ,
16- Up ,
16+ Up ,
1717 Classic
1818 }
1919
@@ -114,7 +114,7 @@ public ComboBoxPopupPlacement PopupPlacement
114114 }
115115
116116 #endregion
117-
117+
118118 #region Background property
119119
120120 private static readonly DependencyPropertyKey BackgroundPropertyKey =
@@ -233,9 +233,9 @@ private CustomPopupPlacement[] ComboBoxCustomPopupPlacementCallback(
233233 SetupVisiblePlacementWidth ( visualAncestry ) ;
234234
235235 var data = GetPositioningData ( visualAncestry , popupSize , targetSize , offset ) ;
236- var preferUpIfSafe = data . LocationY + data . PopupSize . Height > data . ScreenHeight ;
236+ var preferUpIfSafe = data . LocationY + data . PopupSize . Height > data . ScreenHeight ;
237237
238- if ( ClassicMode
238+ if ( ClassicMode
239239 || data . LocationX + data . PopupSize . Width - data . RealOffsetX > data . ScreenWidth
240240 || data . LocationX - data . RealOffsetX < 0
241241 || ! preferUpIfSafe && data . LocationY - Math . Abs ( data . NewDownY ) < 0 )
@@ -274,10 +274,10 @@ private PositioningData GetPositioningData(IEnumerable<DependencyObject> visualA
274274 var screen = Screen . FromPoint ( locationFromScreen ) ;
275275 var screenWidth = ( int ) DpiHelper . TransformToDeviceX ( mainVisual , ( int ) screen . Bounds . Width ) ;
276276 var screenHeight = ( int ) DpiHelper . TransformToDeviceY ( mainVisual , ( int ) screen . Bounds . Height ) ;
277-
277+
278278 //Adjust the location to be in terms of the current screen
279- var locationX = ( int ) locationFromScreen . X % screenWidth - screen . Bounds . X ;
280- var locationY = ( int ) locationFromScreen . Y % screenHeight - screen . Bounds . Y ;
279+ var locationX = ( int ) ( locationFromScreen . X - screen . Bounds . X ) % screenWidth ;
280+ var locationY = ( int ) ( locationFromScreen . Y - screen . Bounds . Y ) % screenHeight ;
281281
282282 var upVerticalOffsetIndepent = DpiHelper . TransformToDeviceY ( mainVisual , UpVerticalOffset ) ;
283283 var newUpY = upVerticalOffsetIndepent - popupSize . Height + targetSize . Height ;
@@ -330,8 +330,8 @@ private void UpdateChildTemplate(ComboBoxPopupPlacement placement)
330330 case ComboBoxPopupPlacement . Up :
331331 SetChildTemplateIfNeed ( UpContentTemplate ) ;
332332 break ;
333- // default:
334- // throw new NotImplementedException($"Unexpected value {placement} of the {nameof(PopupPlacement)} property inside the {nameof(ComboBoxPopup)} control.");
333+ // default:
334+ // throw new NotImplementedException($"Unexpected value {placement} of the {nameof(PopupPlacement)} property inside the {nameof(ComboBoxPopup)} control.");
335335 }
336336 }
337337
@@ -356,7 +356,7 @@ private static CustomPopupPlacement GetClassicPopupPlacement(ComboBoxPopup popup
356356 }
357357
358358 private static CustomPopupPlacement GetDownPopupPlacement ( PositioningData data )
359- {
359+ {
360360 return new CustomPopupPlacement ( new Point ( data . OffsetX , data . NewDownY ) , PopupPrimaryAxis . None ) ;
361361 }
362362
0 commit comments