krisdyson
krisdyson

Reputation: 3255

Cannot navigate to another page

I have a button and a tapped event:

private void btnSetLocationName_Click_1(object sender, RoutedEventArgs e)
    {
        ApplicationModel.LocationName = locationName.Text;
        Frame.Navigate(typeof(GroupsPage));
    }

I want to just navigate to another page. Unfortunately, Frame.Navigate does not work. I have also tried to make sure it runs in the GUI thread: await this.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => Frame.Navigate(typeof(GroupsPage)));

However, it should do, as the click handler for the button runs in the GUI thread.

The following error occurs: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

Upvotes: 2

Views: 1960

Answers (1)

krisdyson
krisdyson

Reputation: 3255

OK, after commenting out bits of code until it worked, it turns out I had an empty OnNavigatedTo override:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    //base.OnNavigatedTo(e);
}

If you uncomment base.OnNavigatedTo it now works.

I think what threw me was that the error occurred when navigating FROM a page with this empty override. Also, the cryptic error message didn't help much.

Upvotes: 6

Related Questions