I’ve read up on how WPF handles the shutdown event.
http://msdn.microsoft.com/en-us/library/system.windows.application.shutdownmode.aspx
However in my project I haven’t specified the StartupURI in the application xaml. However when the first window of my application closes, the entire application closes.
One way I have handled this so far is to create an empty window, and choose to not show it. This way I can go on to close/open windows without WPF calling shutdown when the user chooses to close the first window.
However my solution doesn’t feel elegant, is there a better way to handle this?
Why don’t you use
OnExplicitShutdownif you don’t want it to close when the last window is gone?