@@ -13,7 +13,7 @@ public enum ComboBoxPopupPlacement
13
13
{
14
14
Undefined ,
15
15
Down ,
16
- Up ,
16
+ Up ,
17
17
Classic
18
18
}
19
19
@@ -114,7 +114,7 @@ public ComboBoxPopupPlacement PopupPlacement
114
114
}
115
115
116
116
#endregion
117
-
117
+
118
118
#region Background property
119
119
120
120
private static readonly DependencyPropertyKey BackgroundPropertyKey =
@@ -233,9 +233,9 @@ private CustomPopupPlacement[] ComboBoxCustomPopupPlacementCallback(
233
233
SetupVisiblePlacementWidth ( visualAncestry ) ;
234
234
235
235
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 ;
237
237
238
- if ( ClassicMode
238
+ if ( ClassicMode
239
239
|| data . LocationX + data . PopupSize . Width - data . RealOffsetX > data . ScreenWidth
240
240
|| data . LocationX - data . RealOffsetX < 0
241
241
|| ! preferUpIfSafe && data . LocationY - Math . Abs ( data . NewDownY ) < 0 )
@@ -274,10 +274,10 @@ private PositioningData GetPositioningData(IEnumerable<DependencyObject> visualA
274
274
var screen = Screen . FromPoint ( locationFromScreen ) ;
275
275
var screenWidth = ( int ) DpiHelper . TransformToDeviceX ( mainVisual , ( int ) screen . Bounds . Width ) ;
276
276
var screenHeight = ( int ) DpiHelper . TransformToDeviceY ( mainVisual , ( int ) screen . Bounds . Height ) ;
277
-
277
+
278
278
//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 ;
281
281
282
282
var upVerticalOffsetIndepent = DpiHelper . TransformToDeviceY ( mainVisual , UpVerticalOffset ) ;
283
283
var newUpY = upVerticalOffsetIndepent - popupSize . Height + targetSize . Height ;
@@ -330,8 +330,8 @@ private void UpdateChildTemplate(ComboBoxPopupPlacement placement)
330
330
case ComboBoxPopupPlacement . Up :
331
331
SetChildTemplateIfNeed ( UpContentTemplate ) ;
332
332
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.");
335
335
}
336
336
}
337
337
@@ -356,7 +356,7 @@ private static CustomPopupPlacement GetClassicPopupPlacement(ComboBoxPopup popup
356
356
}
357
357
358
358
private static CustomPopupPlacement GetDownPopupPlacement ( PositioningData data )
359
- {
359
+ {
360
360
return new CustomPopupPlacement ( new Point ( data . OffsetX , data . NewDownY ) , PopupPrimaryAxis . None ) ;
361
361
}
362
362
0 commit comments