Save the page state when navigating out

Say I have two pages, A and B.

The user can modify things on page A then navigate to page B. When he is on page B, he clicks the "Back" button to go to page A. Everything that has been done previously is lost.

There is a way to get the exact same state by using

this.NavigationCacheMode = 
        Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;

But is there a way to know whether the page is opened for the first time a by using the back button?

Answers


yes it is:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
  if (e.NavigationMode == NavigationMode.Back)
  {
    // LoadPreviousSate...
  }
}

You also should've a look at ApplicationExecutionState (in OnLaunched event in App.xaml). If you navigate to Page B, Apps suspends, App continues, user navigates to Page A the NavigationMode will be New!


Need Your Help

How can I search upto sub level categories using mysql?

php mysql select category product

I have a database of 30000 products and all products has assigned different categories. There is a separate table for all categories & sub-categories are also stored into same table.

Only one of my array adapters will work at a time in my row

java android textview android-arrayadapter listadapter

I have two textfields in my row, and I'm using array adapters to assign their text. However, only one of them will work at a time. If I comment one out, then the other will work, and vice versa. Wh...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.