Question

I'm developing a little app for Windows Phone 8 that has 2 pages (1 is of course the main page).

When page2 is reached I want to check if this page has been reached by pressing the back button on the phone. I want to do something like this:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    if (backButton.isPressed()) {
        // this page has been reached by pressing the back button on the phone
    } else {
        // this page has been reached by NavigationService.Navigate()
    }
}

Is there a native API to do that?

Was it helpful?

Solution

Is this what you need?

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    if (e.NavigationMode == NavigationMode.Back)
    {
        ...
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top