@@ -61,12 +61,15 @@ private CustomPopupPlacement[] CustomPopupPlacementMethod(Size popupSize, Size t
61
61
UIElement ? topLevelElement = null ;
62
62
FindControls ( this . PlacementTarget , ref ribbon , ref topLevelElement ) ;
63
63
64
+ var dpiScale = VisualTreeHelper . GetDpi ( this . PlacementTarget ) ;
65
+
64
66
// Exclude QAT items
65
67
var notQuickAccessItem = ! IsQuickAccessItem ( this . PlacementTarget ) ;
66
68
var notContextMenuChild = ! IsContextMenuChild ( this . PlacementTarget ) ;
67
69
var rightToLeftOffset = this . FlowDirection == FlowDirection . RightToLeft
68
70
? - popupSize . Width
69
71
: 0 ;
72
+ var rightToLeftOffsetScaled = rightToLeftOffset * dpiScale . DpiScaleX ;
70
73
71
74
var decoratorChild = GetDecoratorChild ( topLevelElement ) ;
72
75
@@ -75,9 +78,12 @@ private CustomPopupPlacement[] CustomPopupPlacementMethod(Size popupSize, Size t
75
78
&& ribbon is not null )
76
79
{
77
80
var belowY = ribbon . TranslatePoint ( new Point ( 0 , ribbon . ActualHeight ) , this . PlacementTarget ) . Y ;
81
+ belowY *= dpiScale . DpiScaleY ;
78
82
var aboveY = ribbon . TranslatePoint ( new Point ( 0 , 0 ) , this . PlacementTarget ) . Y - popupSize . Height ;
79
- var below = new CustomPopupPlacement ( new Point ( rightToLeftOffset , belowY + 1 ) , PopupPrimaryAxis . Horizontal ) ;
80
- var above = new CustomPopupPlacement ( new Point ( rightToLeftOffset , aboveY - 1 ) , PopupPrimaryAxis . Horizontal ) ;
83
+ aboveY *= dpiScale . DpiScaleY ;
84
+
85
+ var below = new CustomPopupPlacement ( new Point ( rightToLeftOffsetScaled , belowY + 1 ) , PopupPrimaryAxis . Horizontal ) ;
86
+ var above = new CustomPopupPlacement ( new Point ( rightToLeftOffsetScaled , aboveY - 1 ) , PopupPrimaryAxis . Horizontal ) ;
81
87
return new [ ] { below , above } ;
82
88
}
83
89
@@ -89,16 +95,19 @@ private CustomPopupPlacement[] CustomPopupPlacementMethod(Size popupSize, Size t
89
95
{
90
96
// Placed on Popup?
91
97
var belowY = decoratorChild . TranslatePoint ( new Point ( 0 , ( ( FrameworkElement ) decoratorChild ) . ActualHeight ) , this . PlacementTarget ) . Y ;
98
+ belowY *= dpiScale . DpiScaleY ;
92
99
var aboveY = decoratorChild . TranslatePoint ( new Point ( 0 , 0 ) , this . PlacementTarget ) . Y - popupSize . Height ;
93
- var below = new CustomPopupPlacement ( new Point ( rightToLeftOffset , belowY + 1 ) , PopupPrimaryAxis . Horizontal ) ;
94
- var above = new CustomPopupPlacement ( new Point ( rightToLeftOffset , aboveY - 1 ) , PopupPrimaryAxis . Horizontal ) ;
100
+ aboveY *= dpiScale . DpiScaleY ;
101
+
102
+ var below = new CustomPopupPlacement ( new Point ( rightToLeftOffsetScaled , belowY + 1 ) , PopupPrimaryAxis . Horizontal ) ;
103
+ var above = new CustomPopupPlacement ( new Point ( rightToLeftOffsetScaled , aboveY - 1 ) , PopupPrimaryAxis . Horizontal ) ;
95
104
return new [ ] { below , above } ;
96
105
}
97
106
98
107
return new [ ]
99
108
{
100
- new CustomPopupPlacement ( new Point ( rightToLeftOffset , this . PlacementTarget . RenderSize . Height + 1 ) , PopupPrimaryAxis . Horizontal ) ,
101
- new CustomPopupPlacement ( new Point ( rightToLeftOffset , - popupSize . Height - 1 ) , PopupPrimaryAxis . Horizontal )
109
+ new CustomPopupPlacement ( new Point ( rightToLeftOffsetScaled , ( this . PlacementTarget . RenderSize . Height + 1 ) * dpiScale . DpiScaleY ) , PopupPrimaryAxis . Horizontal ) ,
110
+ new CustomPopupPlacement ( new Point ( rightToLeftOffsetScaled , ( - popupSize . Height - 1 ) * dpiScale . DpiScaleY ) , PopupPrimaryAxis . Horizontal )
102
111
} ;
103
112
}
104
113
0 commit comments