How to get the page that the user redirected from

60 Views Asked by At

I develop an app for Windows Store and I have a navigation code that look like this:

    Frame.Navigate(typeof(HubPage), datatopass);

Now, I want to be able to get the page name that the user redirected from.

For example I have the code above in more than one page and I want to be able in the hubPage to write code that will give me indication from which page the user redurected.

I know that I can add the page name in 'dataToPass' var but I would like to avoid this.

My question is how can I get the previuos page name?

1

There are 1 best solutions below

0
On

in wp8.1 (windows store apps) you can know the previous page and even whole stack of previously redirected pages by below code.

var lastPage = Frame.BackStack.Last().SourcePageType

BackStack property will help you more in this context.