I am unable to shutdown my WPF application on closing the main window. Just facing this issue after adding new window (splash screen) to my project. Below is the newly added code in App.xaml.cs
SplashScreen splash = new SplashScreen();
splash.Show();
MainWindow main = new MainWindow();
this.MainWindow = main;
Thread.Sleep(2000);
splash.Close();
Try to set the
Shutdownmodeof theApptoShutdownMode.OnMainWindowClose:Then the app should shutdown when you close
main(assuming you actually show it first).