0
votes

I have set up my Xamarin.Forms Prism application to use a Master-Detail Page (with MasterBehavior set to Popover) for its navigation, but I am noticing a few differences between my Prism app and the sample Xamarin.Forms app using this page (https://developer.xamarin.com/guides/xamarin-forms/user-interface/navigation/master-detail-page/).

On Android, clicking the hamburger icon makes the master slide out in both apps. In the sample app, the hamburger icon remains visible. In my Prism app, the hamburger icon does not remain visible, as the master view takes the full height of the screen, as shown below:

Android

On UWP, clicking the hamburger icon makes the master slide out in both apps. In the sample app, the hamburger icon remains visible and the title of the master page is shown at the top. In my Prism app, neither of these items are visible, as shown below:

UWP

There also appears to be some type of padding or empty space at the top and bottom of the Prism app master view.

Are these differences introduced by Prism itself, or is there a way to configure the master to behave similar to the vanilla Xamarin.Forms sample?


UPDATED SCREENSHOTS

To better demonstrate the issue that I am seeing, here are some more screenshots.

Xamarin sample, app launch and then hitting the hamburger icon keeps the navigation bar (with hamburger icon) visible with the master visible:

Xam

My Prism app, app launch and then hitting the hamburger icon makes the master view take up the entire height of the screen:

Prism

1

1 Answers

2
votes

In order to get the hamburger icon to show when you navigation to a page you have to wrap the Detail in a NavigationPage. So register the navigationPage for navigation, and then add it to your navigation URI.

    protected override void OnInitialized()
    {
        NavigationService.NavigateAsync("MyMasterDetail/NavigationPage/MainPage");
    }

Take a look at this sandbox example:

https://github.com/PrismLibrary/Prism/tree/master/Sandbox/Xamarin