Step 1- Create your own popup class & derive it from Popup class
In above code GetWindowRect is used to set current window location. TopmostProperty have bonded with event OnTopmostChanged which updates the window.
Step-2 Add namespace reference in your XAML Page.
Step-3 Call popup control
That's it your popup will works properly.