导航到的OnNavigatedTo另一页?(Navigate to another page at

2019-08-02 17:41发布

为什么该方法导航在调用的时候不工作的OnNavigatedTo此页面的事件?

这种行为是可重复的吗?

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

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
}

Answer 1:

为了得到我现在用的调度权的行为:

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


文章来源: Navigate to another page at OnNavigatedTo?