为什么在此页面的Navigate事件中调用时方法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
}
答案 0 :(得分:7)
为了获得正确的行为,我现在正在使用调度程序:
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));
}));