开发者

WPF popup control placement on two monitors setup with different resolution

I use two displays with different resolutions on my development machine. The display with a smaller resolution is configured as primary dis开发者_Go百科play. If I maximize my WPF application on the secondary display and show a popup control at the bottom it appears repositioned:

WPF popup control placement on two monitors setup with different resolution

I guess, the framework uses the lower resolution of the primary display to check if the popup window has to be repositioned. Doesn't the WPF framework check for the current display resolution or do I have to configure this myself?


For repositioning popup control on two monitor, better to set Popup control Horizontal and Vertical offset based on PointToScreen property of MainWindow

var mousePosition = Mouse.GetPosition(Application.Current.MainWindow);
var pointToScreen = Application.Current.MainWindow.PointToScreen(mousePosition);

_popup.HorizontalOffset = pointToScreen.X;
_popup.VerticalOffset = pointToScreen.Y;

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜