I had the same problem. I wanted it so that when I moved to Metro (the Windows Store was correct), it would create a new instance. However, returning, he would save the data that I wanted to save.
So, I also used NavigationCacheMode = NavigationCacheMode.Enabled. I found that no matter what path I took, forward or backward, everything was always saved. So, I would go forward a few pages and then step back. Hoping that everything was reset when I moved forward, I invariably discovered that this was not so; he saved the data.
I tried everything, including writing my own feedback button code to enable NavigationCacheMode = NavigationCacheMode.Disabled, but to no avail. As others pointed out, after you turned it on, NavigationCacheMode just doesn't turn off.
I have found a solution. I went to LayoutAwarePage.cs and just made minor changes. In the "OnNavigatedTo" section, I found the line:
However, the comment contradicted what I wanted. I searched for state load in a unidirectional template. If you move forward, I need a state load; if moving backward, I wanted the behavior to point to a comment - there was no state loading.
So I just changed the line.
I tested it and it works great. Now, when he moves backward, he remembers the state and keeps the page the same. Moving forward, it loads fresh.
It may not be best practice, but I do not call "OnNavigatedTo" from my code. I do everything through "LoadState". If you override "OnNavigatedTo" in code, you may see different behavior.
Thank,
Joseph Irwin
jkeagle13 Aug 30 2018-12-12T00: 00Z
source share