Windows Phone 8导航回同一页面 [英] Windows Phone 8 Navigate back to same page
问题描述
有谁知道是否 NavigationService.Navigate
有
的任何限制,或者在尝试导航回自身时没有调用页面默认构造函数?所以我可以说我在MainPage.xaml上,我做了一些事情,想要使用 NavigationService.Navigate(new
。我现在有了这个,并在默认构造函数
Uri(" /MainPage.xaml" ;, UriKind.RelativeOrAbsolute) );
中设置了一个断点,当我尝试将页面导回到自身时,它永远不会被击中。
编辑:从我的测试来看,它似乎在缓存自己。我通过在我的导航中输入一个查询字符串变量测试了这个理论, " /MainPage.xaml?z ="
它以这种方式点击构造函数,但不是仅仅导航回"MainPage.xaml"。
+ DateTime.Now.ToLocalTime()
From my testing it seems like it caches itself. I tested this theory by putting a querystring variable to my navigation, "/MainPage.xaml?z="
+ DateTime.Now.ToLocalTime()
and it hit the constructor that way but not by just navigating back to just "MainPage.xaml".
推荐答案
最初,在WP7中,导航到已经在后台堆栈上的页面会创建一个新的页面实例。 但是,从WP7.5(IIRC)开始,如果导航Uri相同,则此行为已更改为重用后堆栈中的现有页面。
Originally, in WP7, navigating to a page already on the back stack would create a new instance of the page. However, starting in WP7.5 (IIRC) this behavior was changed to reuse the existing page from the back stack if the navigation Uri was identical.
以下是有关该主题的一些其他资源:
Here are some additional resources on the topic:
这篇关于Windows Phone 8导航回同一页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!