Search code examples
c#wpfxamlz-order

WPF Popup ZOrder


I am using a WPF Popup, but it popups up above every single window on my desktop, even when my application is minimized. How can I make it stay only on the window it originated? The same thing happens when my window is behind other windows: the popup displays above them all.

"There must be something can be done!"

Thanks.


Solution

  • I've tried to solve this issue as well, and have found no good solution. This seems to be the way it is supposed to work, and you can't override that.

    The only solution I've come up with is to just use a regular layout panel and raise it's Z-Index, so it is the top-level control (this sort of simulates the Popup). The only time I have found that this won't work is when you have WinForms on the screen through WindowsFormsHosts. Those Winforms are always at a higher Z-Index than any of the WPF stuff. That is when you have to use a Popup to get around it.