0

I have these pages on a windows project

page1.xaml

page2.xaml

page3.xaml

page4.xaml

After i do some operations on page1 i call this;

Frame.Navigate(typeof(page2), document);

On page 2 i do some stuff with the document, then i navigate to page3.xaml

Frame.Navigate(typeof(page3), document);

Then i do some more stuff on page 3 and go to page4.xaml.

And in page4.xaml i have a button that when pressed i want to go back to page2,xaml not a new one, but the same one i came from.

is this possible?

Amy Peng - MSFT
  • 1,902
  • 11
  • 14
Thought
  • 5,326
  • 7
  • 33
  • 69

1 Answers1

3

To navigate to the same instance of page2, you need to set the Page's NavigationCacheMode Property to Enabled or Required :

NavigationCacheMode="Enabled" 

now the difference between those two is whether or not they take CacheSize into consideration or not, from msdn :

The difference in behavior is that Enabled might not be cached if the frame's cache size limit (CacheSize) is exceeded, whereas Required always generates an entry no matter the size limit.

SamTh3D3v
  • 9,854
  • 3
  • 31
  • 47
  • i see , so if i enable it when i do Frame.Navigate(typeof(page2), document); it would to to a cached version that i used before instead of a new instance of page2, right?. What if i wanted to navigate to a new instance of page2? – Thought Aug 15 '15 at 03:16
  • sorry i was editing my comment when you wrote yours, not sure if you read the second part : What if i wanted to navigate to a new instance of page2? – Thought Aug 15 '15 at 03:24
  • http://stackoverflow.com/questions/28134285/how-to-remove-a-specific-page-from-navigation-cache-in-windows-phone-8-1-rt – SamTh3D3v Aug 15 '15 at 03:30