I've WPF application which has one Main window on which I'm opening a Popup window. The problem I'm facing is the Popup window always stays on top. If I open some other application(any windows application) the main window goes into background but the Popup windows remain on top.However if I minimize the Mainwindow the Popup also minimizes.
Please help on overcoming this issue.
Update:
I am opening the Popup as below
myPopup.IsOpen = true;
This solved my problem.
Popups
do - as far as i know - not suppot such a behavior, their intended usage is forComboxBox
-dropdowns and the like as far as i can tell. To realize something like that you can use a normalWindow
and set itsOwner
to the main window on which it should be dependent. This will cause the popup-window to stay on top of its owner & to minimize together with the owner.e.g.
(Windows cannot be re-opened once closed, so to reuse a window you just have to
Hide()
it when the user tries to close it (handleClosing
event and cancel using event args))H.B. is correct - WPF Popup control was not intended do be not top-most. On the other hand - check out the following blog post on using
user32
for achieving your goal: http://chriscavanagh.wordpress.com/2008/08/13/non-topmost-wpf-popup/Are you creating the PopUp using the WPF control? The way this control paints popup leads to the behaviour you are describing. Consider creating a new Window showing the content you´d like to display.
Create your PopUp window modal to the parent control only, as demonstrated by Billy Holli and Brad Leach. That way it will stay on top of the application/window which opened the popup control, but will not stay on top of other windows/applications any longer.