Reputation: 21
Hi i am working on one app having menupage.If user is in menupage and press back button of the phone, I want the application to be closed. Currently if i am pressing back button it navigates to previous pages.
Please Help me, Genuine help is appreciated.
Upvotes: 0
Views: 92
Reputation: 16361
You need to clear the BackStack on that page (ideally in OnNavigatedTo)
while (this.NavigationService.BackStack.Any())
{
this.NavigationService.RemoveBackEntry();
}
Upvotes: 1
Reputation: 1560
Put this code when you need to close your application.
Application.Current.Terminate();
Upvotes: 0