Maxim Alexeyev
Maxim Alexeyev

Reputation: 1031

Blank page when NavigationPage is used in Prism.Forms after upgrade to 8.x

After upgrading Prism library to version 8.0.0.1909 from 7.x in my Xamarin.Forms project I have a problem with using Navigation Page.

This is the code I have in OnInitialized method:

        NavigationService.NavigateAsync("AppNavigationPage/MainPage");

Now it results in blank screen. It used to work fine. When I don't use navigation Page

        NavigationService.NavigateAsync("MainPage");

I can see my MainPage just fine.

One additional note, in my MainPage I have following

protected override void OnAppearing()
{
    base.OnAppearing();
    var vm = BindingContext as MainPageViewModel;
    if (vm != null)
        vm.OnAppearing();
}

When I use NavigationPage, breakpoint doesn't hit there.

I debug it on Android.

Upvotes: 1

Views: 399

Answers (1)

Maxim Alexeyev
Maxim Alexeyev

Reputation: 1031

Looks like it was very old code to set starting page. I changed to

        MainPage = new NavigationPage(new MainPage());

Seems to be working now.

Upvotes: 1

Related Questions