Frage

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?

War es hilfreich?

Lösung

Is this what you need?

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    if (e.NavigationMode == NavigationMode.Back)
    {
        ...
    }
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top