Windows Phone 8导航回同一页面 [英] Windows Phone 8 Navigate back to same page

查看:58
本文介绍了Windows Phone 8导航回同一页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道是否  NavigationService.Navigate  有
的任何限制,或者在尝试导航回自身时没有调用页面默认构造函数?所以我可以说我在MainPage.xaml上,我做了一些事情,想要使用 
NavigationService.Navigate(new
Uri(" /MainPage.xaml" ;, UriKind.RelativeOrAbsolute) );
。我现在有了这个,并在默认构造函数
中设置了一个断点,当我尝试将页面导回到自身时,它永远不会被击中。 

编辑:从我的测试来看,它似乎在缓存自己。我通过在我的导航中输入一个查询字符串变量测试了这个理论, " /MainPage.xaml?z ="
+ DateTime.Now.ToLocalTime()
 它以这种方式点击构造函数,但不是仅仅导航回"MainPage.xaml"。

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的应用程序页面模型

如何使用Windows Phone的后端堆栈进行导航

Windows Phone中的框架,页面和导航功能

Windows Phone的应用程序结构和导航模型

Windows Phone的导航,方向和手势


这篇关于Windows Phone 8导航回同一页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆