[英]Windows Phone back button problem
我有一個應用程序有2個表單,主要表單和屬性表單,當我單擊導航到屬性的按鈕,然后我單擊后退按鈕(硬件)我得到我期望的,我的應用程序返回到主窗體,但如果我應用屬性並再次導航到主頁並再次按下后退按鈕我返回屬性,如果我繼續推回,我可以返回無限屬性/主頁,這是不好的,因為主頁已更改其屬性。
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
也許我可以刪除導航緩存? 我試過這個,但編譯器告訴我它是只讀的:
this.NavigationCacheMode = System.Windows.Navigation.NavigationCacheMode.Disabled;
我目前的導航代碼是:
NavigationService.Navigate(new Uri("/Properties.xaml",UriKind.RelativeOrAbsolute));
and
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
在Windows Phone中解決循環導航Silverlight應用程序已經實現了這個問題。
或者,您可以GoBack並刷新主頁,而不是導航到主頁的新實例,如果您發現更自然。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.