其他分享
首页 > 其他分享> > c-导航到OnNavigatedTo的另一页?

c-导航到OnNavigatedTo的另一页?

作者:互联网

为什么在此页面的OnNavigatedTo事件中调用方法Navigate无效?

这种行为对您来说可重现吗?

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

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
}

解决方法:

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

    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));
    }));

标签:c,events,winrt-xaml,microsoft-metro,c-cx
来源: https://codeday.me/bug/20191012/1896800.html