为什么方法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
}
最佳答案
为了获得正确的行为,我现在使用调度程序:
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++ - 在 OnNavigatedTo 导航到另一个页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13376122/