Reputation: 3848
Say I have a WPF application with a button. In the buttom click event, I created a System.Windows.Window instance. For some reason, I forgot to call window.ShowDialog() and leave there. When my main application starts, then clicked on the button, nothing happens of cause. But when I want to exit this application, the main window closed, but the process is still running. I'm not sure why causes this behavior. It's easy to be fixed, but does anyone know
Upvotes: 2
Views: 189
Reputation: 437336
I imagine it's because the default for Application.ShutdownMode
is ShutdownMode.OnLastWindowClose
. If you set it to ShutdownMode.OnMainWindowClose
it should exit immediately after you close the main window.
Upvotes: 7