Skip to main content
2 of 3
added 197 characters in body
Kylo Ren
  • 8.9k
  • 6
  • 44
  • 68

Use any of the following:

1.

 App.Current.Shutdown(); OR Application.Current.Shutdown(); 

2.

 App.Current.MainWindow.Close(); OR Application.Current.MainWindow.Close(); 

3. Above all methods will call closing event of Window class and execution may stop at some point (cause usually applications put dialogues like 'are you sure?' or 'Would you like to save data before closing?', before a window is closed completely)

But if you want to terminate the application without any warning immediately. Use below

 Environment.Exit(0); 
Kylo Ren
  • 8.9k
  • 6
  • 44
  • 68