Can't go to next frame
I have a problem navigating to the next page in a section:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Debug.WriteLine("Test1");
Frame.Navigate(typeof(LoginView));
Debug.WriteLine("Test2");
}
The Frame.Navigate method doesn't work at all only if it calls OnNavigatedTo. When debugging, I see "Test1" and "Test2", but nothing else happens. Any ideas? Project: Windows Phone Store App 8.1
+3
source to share
2 answers
Add async keyword to OnNavigatedTo method and add expectation Task.Delay (10); before calling Frame.Navigate (). Alternatively, you can do Frame.Navigate () in the dispatcher.
1) using a delay
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
await Task.Delay(10);
Frame.Navigate(typeof (LoginView));
}
2) using the Manager
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Frame.Navigate(typeof(LoginView));
});
}
+2
source to share