简体   繁体   中英

avoiding recreation of a page when navigating between pages in Windows 8 app

This is a question regarding navigation between pages in Windows 8 app -

How can I avoid the re-creation of the page when navigating between pages ?

For example - Whether I'm using frame.Navigate(typeof(MyPage1), null); or Frame.GoBack(); (after switching to another page from MyPage1), a new instance of MyPage1 will be created. I want to avoid it in order to keep the same UI state in MyPage1. Using MVVM, I can restore most of it, but not all... (for instance, selected item in a tree). How can this be done ?

将其放在您不想破坏的页面的构造函数中:

this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM