2
votes

I have a PopUp window with a popup control.There is a main window from which this PopUp is displayed. PopUp displays data after processing the query which takes time.So while the data in the PopUp is processing,if I maximise other windows then the PopUp is displayed on the other windows as well.

I have made MainWindow owner of the PopUp window in PopUpWindow.xaml.cs as:

this.Owner = Application.Current.MainWindow;

and I have set "StaysOpen" property of PopUp Window to false.But still issue persists.How to stop PopUp from displaying on other window,if other windows are maximised.

1
What is the question?Mark Green
how to stop PopUp from displaying on other window,if other windows are maximised.K T
Try for Popup set property Visibility to Collapsed. Like this: Visibility="Collapsed" or in code: MyPopup.Visibility = Visibility.Collapsed;.Anatoliy Nikolaev
K T - why have you accepted only 4 answers for you 16 questions? And why do you ignore any comments?MikroDel
I have corrected my mistake and accpeted the answer.Please dont misunderstand me MikroDel.K T

1 Answers

2
votes

You can explicitly close the popup when its owner window is deactivated, i.e. when another window gets the focus and comes to the top, using the Deactivated event:

    window.Deactivated += 
        (sender, args) => {
            thePopup.IsOpen = false;
        };

You might also want to capture the IsOpen state and restore it when the window is Activated.