@@ -28,13 +28,21 @@ public enum PopupBoxPlacementMode
28
28
/// </summary>
29
29
BottomAndAlignRightEdges ,
30
30
/// <summary>
31
+ /// Display the popup below the toggle, and align the center of the popup with the center of the toggle.
32
+ /// </summary>
33
+ BottomAndAlignCentres ,
34
+ /// <summary>
31
35
/// Display the popup above the toggle, and align the left edges.
32
36
/// </summary>
33
37
TopAndAlignLeftEdges ,
34
38
/// <summary>
35
39
/// Display the popup above the toggle, and align the right edges.
36
40
/// </summary>
37
- TopAndAlignRightEdges
41
+ TopAndAlignRightEdges ,
42
+ /// <summary>
43
+ /// Display the popup above the toggle, and align the center of the popup with the center of the toggle.
44
+ /// </summary>
45
+ TopAndAlignCentres
38
46
}
39
47
40
48
/// <summary>
@@ -211,6 +219,10 @@ private CustomPopupPlacement[] GetPopupPlacement(Size popupSize, Size targetSize
211
219
x = 0 - popupSize . Width + targetSize . Width - offset . X ;
212
220
y = targetSize . Height - Math . Abs ( offset . Y ) ;
213
221
break ;
222
+ case PopupBoxPlacementMode . BottomAndAlignCentres :
223
+ x = targetSize . Width / 2 - popupSize . Width / 2 ;
224
+ y = targetSize . Height - Math . Abs ( offset . Y ) ;
225
+ break ;
214
226
case PopupBoxPlacementMode . TopAndAlignLeftEdges :
215
227
x = 0 - Math . Abs ( offset . X * 3 ) ;
216
228
y = 0 - popupSize . Height - Math . Abs ( offset . Y * 2 ) ;
@@ -219,6 +231,10 @@ private CustomPopupPlacement[] GetPopupPlacement(Size popupSize, Size targetSize
219
231
x = 0 - popupSize . Width + targetSize . Width - offset . X ;
220
232
y = 0 - popupSize . Height - Math . Abs ( offset . Y * 2 ) ;
221
233
break ;
234
+ case PopupBoxPlacementMode . TopAndAlignCentres :
235
+ x = targetSize . Width / 2 - popupSize . Width / 2 ;
236
+ y = 0 - popupSize . Height - Math . Abs ( offset . Y * 2 ) ;
237
+ break ;
222
238
default :
223
239
throw new ArgumentOutOfRangeException ( ) ;
224
240
}
0 commit comments