Search code examples
c#wpfexpression-blend

How to let custom window be closed if mainwindow is closed?


I designed a custom messagebox for my WPF application with Expression Blend 4. I copied the generated MyCustomBox.xaml into my project, changed the namespace to access it directly.

My problem is how I can make the mainwindow parent to my custombox? If I close my mainwindow the custombox will still be shown. I would like to let the custombox be closed if the mainwindow is being closed. My Custom MessageBox is a subclass of Window.

Thanks in advance for any hints :)


Solution

  • Set the Owner of the popup window to the main window.