导航到OnNavigatedTo的另一个页面? [英] Navigate to another page at OnNavigatedTo?

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

问题描述

为什么方法导航在调用时无效 OnNavigatedTo 活动

Why does the method Navigate not work when called in the OnNavigatedTo event of this page?

这个行为是否可为您重现?

Is this behavior reproducible for you?

任何想法如何避免这个问题? / p>

Any ideas how to avoid this problem?

void LockScreenPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e)
{
    //if user has no PIN protection
    this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(AnotherPage::typeid));

    //else verify PIN
}


推荐答案

为了获得正确的行为,我现在使用调度程序:

To get the right behavior I am now using the dispatcher:

    this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this] () {
        this->Frame->Navigate(Windows::UI::Xaml::Interop::TypeName(AnotherPage::typeid));
    }));

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

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