Reputation: 3
I am opening one popup during the run time after that i will open the dialog box using window key down event now my previous popup still shows? how to close the previous pop up window ? Can any one helps ?
Hi thanks for your words,
but unfortunately i am not using WPF popup. we have our own control. When we open Microsoft dialog window our popup window still opens. If i open dialog by pressing Window+E key mu pop up is closing as we expected but i open dialog throw Window_KeyDown event , in this case my popup does not close? Please help me?
Upvotes: 0
Views: 1481
Reputation: 20451
assuming you are talking about the WPF popup control, this solution may work for you
<Popup StaysOpen="false" />
Upvotes: 1
Reputation: 69959
You just need to declare a bool
property to data bind to the Popup.IsOpen
Property:
<Popup IsOpen="{Binding IsPopupOpen}">
<TextBlock Text="I'm a Popup" />
</Popup>
Then you can open and/or close it from your code behind or view model:
// Open Popup
IsPopupOpen = true;
// Close Popup
IsPopupOpen = false;
Upvotes: 1