I’m developing a Windows Phone app.
I have three pages, P1, P2 and P3.
From P1 I can go to P2, and from P2 I can go to P3.
I want to execute some code only when I go back from P3 to P2.
How can I do that?
And if I want to execute another code only when I go from P1 to P2…
Override the
OnNavigatedFrommethod of classPhoneApplicationPageand store the current page in a global static variable.Override
OnNavigatedToas well, in there you check the variable and execute your code depending on it’s value. Dont forget to persist the variable when your application gets tombstoned, you can persist it in thePhoneApplicatiopnPage.Statedictionary