How to get information about the previous page in Frame.GoBack ()

Let's say we have PagePageA, and I have a button that, when clicked, does the following:

Frame.NavigateTo(typeof(PageB));

After the user has finished doing things, he will be moved back from PageB to pageA, calling Frame.GoBack()

I want to be able to determine that I am going back from PageB

I could use:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    e.NavigationMode
}

But this only tells me that I am going back, and not that I am going back from PageB.

Is this even a good approach to working with a Windows phone (did not find this specific case in the documents)?

+1
source share
1 answer

, , Frame.ForwardStack , .

, :

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    var lastPage = Frame.ForwardStack.LastOrDefault();
    if (lastPage != null && lastPage.SourcePageType.Equals(typeof(desiredPage)))
        { /* do something */ }
}
+5

All Articles