Close a WP7 application programmatically?

Vercas picture Vercas · Dec 2, 2010 · Viewed 26.7k times · Source

Possible Duplicate:
Windows Phone 7 close application

How do I programmatically close a WP7 application?

Answer

Syed Umar Ahmed picture Syed Umar Ahmed · Dec 15, 2011

You can always call an exit by doing this at your landing page use this code on click of your application back button:

if (NavigationService.CanGoBack)
{
    while (NavigationService.RemoveBackEntry() != null)
    {
        NavigationService.RemoveBackEntry();
    }
}

This will remove back entries from the stack, and you will press a back button it will close the application without any exception.