为什么无法调用第2页的OnNavigatedTo? [英] Why OnNavigatedTo of page2 can't be called?

查看:96
本文介绍了为什么无法调用第2页的OnNavigatedTo?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,所有

开发WP8时遇到了一个奇怪的问题.

场景:

1.我的应用程序中有2个页面.

    page1和page2

2.在page1中致电page1.NavigationService.Navigate(new Uri("page2.xaml",UriKind.Relative))

3. page2的构造方法始终可以被调用.

4.有时,可以调用page2的OnNavigatedTo,因此page2可以显示在应用程序中.

   但是有时,无法调用page2的OnNavigatedTo,因此无法在应用程序中显示page2,而在应用程序中仍显示页面1.

有人知道为什么不能调用page2的OnNavigatedTo吗?

顺便说一句:第2页的Uri绝对正确.

非常感谢.

解决方案

您的代码使用事件处理程序调用OnNavigatedTo,对吗?通常,您不应该直接调用该方法.

您能发布您的代码吗?

-马克


Hi, All

I met a weird issue when do WP8 development.

scenario:

1. there are 2 pages in my app.

    page1 and page2

2. call page1.NavigationService.Navigate(new Uri("page2.xaml", UriKind.Relative))  in page1

3. Constructor of page2 can always be called.

4. Sometimes, OnNavigatedTo of page2 can be called, so the page2 could be shown in app.

    But sometimes, OnNavigatedTo of page2 can not be called, so the page2 could not be shown in app, page 1 are still shown in app.

Can anybody know why OnNavigatedTo of page2 can't be called?

BTW: Uri of page2 is definitely correct.

Thank you very much.

解决方案

Your code calls OnNavigatedTo using an event handler, correct? You normally shouldn't call that method directly.

Can you post your code please?

-Mark


这篇关于为什么无法调用第2页的OnNavigatedTo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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