Reputation: 790
Say we have some Page
PageA and I have a button that, when clicked, does the following:
Frame.NavigateTo(typeof(PageB));
After the user is done doing stuff, he navigates back from PageB to PageA calling Frame.GoBack()
I want be able to determine that I'm navigating back from PageB
I could use:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
e.NavigationMode
}
But this only tells me that I'm navigating back, not that I'm navigating back from PageB.
Is this even a good windows-phone-guidelines approach (did not find this particular case in the docs)?
Upvotes: 1
Views: 587
Reputation: 29792
I think you should be able to do it by using Frame.ForwardStack property which holds forward navigation history.
A short sample which should work:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var lastPage = Frame.ForwardStack.LastOrDefault();
if (lastPage != null && lastPage.SourcePageType.Equals(typeof(desiredPage)))
{ /* do something */ }
}
Upvotes: 5