Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to code exit functionality in Windows Phone App 7.1. I have tried NavigationService.GoBack() As given in an article Your first Windows Phone 7 App is just a few keystrokes away[^] but it is not working. Please give a solution.
Posted
Updated 24-Jan-13 21:17pm
v3

1 solution

You can always call an exit by doing this at your landing page.Use this code on click of your application back button:
C#
if (NavigationService.CanGoBack)
{
    while (NavigationService.RemoveBackEntry() != null)
    {
        NavigationService.RemoveBackEntry();
    }
}

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

Update:
A couple of ways..
1.http://www.bauer-martin.com/csharp/windows-phone-7-exit-application-on-back-button-796.html[^]
2.http://mobile.dzone.com/articles/windows-phone-mango-sample-3[^]
3.http://stackoverflow.com/questions/3993507/is-there-a-way-to-programmatically-quit-my-app-windows-phone-7[^]
Link 2 has a brief explanation on this regard.Hope that will help you..:)
 
Share this answer
 
v2
Comments
Gaurav K Mishra 25-Jan-13 5:02am    
This script is not Working.
Nandhini Devi 2-Jun-14 3:56am    
did you got the working script ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900