Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone back button problem

I have an app that has 2 forms, the main form and a properties form, when I click the button that navigates into properties and then I click the back button (hardware) I get what I expect, my app returns to the main form, but if I apply the properties and navigate to the main page again and push the back button again I return to properties, and if I keep pushing back I can return to 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 have tried this but the compiler tells me it's read only:

this.NavigationCacheMode = System.Windows.Navigation.NavigationCacheMode.Disabled;

My current navigation code it's:

NavigationService.Navigate(new Uri("/Properties.xaml",UriKind.RelativeOrAbsolute));
and
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
like image 587
Kenny D. Avatar asked Dec 17 '25 04:12

Kenny D.


1 Answers

Solving Circular Navigation in Windows Phone Silverlight Applications has been implemented with this problem in mind.

Alternatively you could GoBack and refresh your main page rather than navigate forward to a new instance of your main page if you find that more natural.

like image 195
Mick N Avatar answered Dec 19 '25 20:12

Mick N



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!