I have an application that has 2 forms, the main form and the properties form, when I click the button that goes into the properties, and then I click the back button (hardware). I get what I expect, my application returns to, but if I apply the properties and go to the main page again and click the "Back" button again, I will return to the properties, and if I continue to push back, I can return to the infinite properties / main page, which is bad because the main page has changed its properties.
Good cases:
MainPage ---> properties --back--> MainPage (No properties were set)
MainPage ---> properties --set--> newMainPage
MainPage ---> properties --set--> MainPage --back--> closeApp
Bad cases:
MainPage ---> properties --set--> MainPage --back--> properties --back--> oldMainPage
MainPage ---> properties --set--> newMainPage ---> properties --set--> new_newMainPage --back--> properties --back--> oldMainPage --back--> properties --back--> old_oldMainPage
Maybe I can delete the navigation cache? I tried this, but the compiler tells me that it is read-only:
this.NavigationCacheMode = System.Windows.Navigation.NavigationCacheMode.Disabled;
My current navigation code is:
NavigationService.Navigate(new Uri("/Properties.xaml",UriKind.RelativeOrAbsolute));
and
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
source