MasterPage is overlapping NavigationBar in MasterDetailPage

AdrnHAdrnH USMember ✭✭

My Problem is that my Masterpage is overlapping the NavigationBar and graying it out. I want the MasterPage to be beneath the navigation bar and only graying the detail out. How can I achieve this?

I am creating a MasterDetailPage like this:

 var navPage = new NavigationPage() { };
 MasterDetailPage masterDetailPage = new MasterDetailPage()
{   
    Master = MenuPage = BuildMenuPage(),
    Detail = NavigationPage = navPage,
};
MainPage = masterDetailPage;
}

private Page BuildMenuPage()
{
    return new MenuPage()
    {
        Title = "Menu",
                Icon = "icon.png", 
                BackgroundColor =  Color.Transparent
    };
}

And navigation to a new Detail Page like this:

private async Task DefaultNavigation(Page page, string pageKey, object parameter, bool animated, string title)
{
    MasterDetailPage mainPage = GetRootPageInstance(); //Singleton

    NavigationPage _navPage = new NavigationPage(page);
    NavigationPage.SetHasNavigationBar(_navPage, false);

    await _navigation.PushAsync(_navPage, animated);
}

Answers

  • KamrankhalilKamrankhalil USMember ✭✭
    edited November 10

    Just add this padding to your master page
    Padding = new Thickness(0, 40, 0, 0);

  • AdrnHAdrnH USMember ✭✭

    Well this is a workaround. But no real solution. It also want the navigation page to be functional.

  • KamrankhalilKamrankhalil USMember ✭✭

    Adding this makes navigation page unfunctional ?

  • AdrnHAdrnH USMember ✭✭
    edited November 12

    Sry not the NavigationPage., The NavigationBar. Well, both are not functional atm the MasterPage is visible, because the MasterPage is a layer aboth NavigationPage and NavigationBar. If I add Padding to the Top this does not mean that the NavigationPage becomes clickable.

  • KamrankhalilKamrankhalil USMember ✭✭

    See this sample code : developer.xamarin.com/samples/xamarin-forms/Navigation/MasterDetailPage/
    I'm assuming you are using android (by your screenshot). In this example, master page is not hiding the navigation bar and everything works. Or maybe i don't understand your problem correctly.

Sign In or Register to comment.