ARTICLE

How to Exit a Windows Store app in Code

Posted by Mahesh Chand Articles | How do I January 05, 2013
This tip shows how to close a Windows Store app in dynamically.
Reader Level:

Recently, I have been working on a large scale Windows 8 app also known as Windows Store app. If you have been dealing with Windows 8 apps, you may also know that we can use ALT+F4 to close a Windows Store or Windows 8 app. 


Every time I build my application, I have to use ALT+F4 to close it and then switch from metro mode to regular mode and it was getting annoying. So, I added a button on the UI (temporarily while building and testing my app) and on that I added exit application functionality.

To close an app in code, all we need to do is, get the current application context and call the Exit method.

The following code snippet will do the trick:

App.Current.Exit();

Login to add your contents and source code to this article
comments
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
HTML 5 + JQUERY CONTROLS
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.