开发者

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 --bac开发者_运维知识库k--> 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));


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜