Marin
Marin

Reputation: 1331

Change page, not navigate to new one

I've got my first page, which asks for credentials. When login is successful, I'd like to change page, but in a way that BACK doesn't navigate to login page again, but out of application. How to achieve this? NavigateServices.Navigate just adds the new page to history stack.

Upvotes: 0

Views: 109

Answers (1)

Shawn Kendrot
Shawn Kendrot

Reputation: 12465

You can achieve this by removing an item from the back stack. In your "second" page override OnNavigatedTo and place the following code:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    if (NavigationService.CanGoBack) NavigationService.RemoveBackEntry();
}

Upvotes: 4

Related Questions