I am having a button called 'bookmarks'. To show the bookmarks I have used the popup. when I clicked on the button called 'bookmarks' the popup is opened and If I clicked on any other button let say, 'Play' which is on the main window should play the video and closes the popup as well. this all is working fine but the problem is ===> When I try to minimize or close the main window, It closes the popup only not the main window. in short, I need to hit the close button twice for closing the main window while the popup is opened.
The code sample that I have used
public void Show(object viewModel, string title, double width, double height)
{
m_popup = new Popup();
m_popup.AllowsTransparency = true;
m_popup.StaysOpen = false;
m_popup.IsOpen = true;
m_popup.PlacementRectangle = new Rect(App.Current.MainWindow.Left + 570, App.Current.MainWindow.Top + 60, 0, 0);
m_popup.VerticalOffset = 20;
ContentControl contentControl = new ContentControl();
contentControl.Content = viewModel;
m_popup.Child = contentControl;
m_popup.Closed += Popup_Closed;
IsActive = true;
}
private void Popup_Closed(object sender, EventArgs e)
{
IsActive = false;
}
Note: please ignore IsActive property. I have used that for another purpose.
I had tried Modal dialog by setting the main window as an owner but It was not useful because I want the main window to be interactive while the popup is opened. please suggest me the solution.
Thanks.....