I encountered a problem in WPF (C#), I need to position a popup on a certain point within the parent window.
I get the parent position with Application.Current.MainWindow.Left
and Application.Current.MainWindow.Top
, it works as long as I don't move the window from one monitor to the other with the Windows shortcut Windows + Shift + ◄/►. If I use the shortcut the properties stay the same as they were before moving the window.
The window has to be WindowState.Maximized
, it works if it is not maximized.
I also tried using Window.GetWindow(this)
instead of Application.Current.MainWindow
, result is the same.
It seems as if the positionchanged event doesn't occur for the Application.Current.MainWindow
and it doesn't update the Left
and Top
properties.
I didn't find anything on this on SO or Google. A workaround, hint or solution are greatly appreciated.