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:
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;
精彩评论