locked
MasterDetailPage navigation bar RRS feed

  • Question

  • User393149 posted

    Hi I Have masterdetailpage, a master and a detail pages. I want to use embded navigation bar of Masterdetailpage and its humburger and back buttons. If navigation bar is placed in details page, back button remains below the masterpage and is not visible to the user, when master page displayed cause of this, I'm going to place navigation bar on masterdetailpage. So I wrap it to Navigationpage. so structure is

    var mdp = new MasterDetailPage(); mdp.Master = new MyMasterPage(); mdp.Detail = new MyDetailPage(); Application.Current.MainPage= new NavigationPage(mdp);

    problem is humburger btn and back btn is not visible until rotate the device.

    after rotate device, both of them displayed and working properly how can I force masterdetailpage to display those without rotate needded?

    Thanks a lot BR

    Wednesday, April 1, 2020 5:20 PM

All replies

  • User382871 posted

    MasterDatailPage is a navigation template, don't put it into the navigation stack. To display the navigation bar, add the Detail page into Navigation stack as a NavigationPage.

    Check the code: ``` var mdp = new MasterDetailPage(); mdp.Master = new MyMasterPage();

    mdp.Detail = new NavigationPage(new MyDetailPage()); Application.Current.MainPage= mdp; ``` Tutorial: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/master-detail-page

    Thursday, April 2, 2020 7:19 AM
  • User393149 posted

    thank for your answer but I explained in your scenario, back button is not visible to user, when master page is presenting and I need back button. before I ask question, I download the sample on microsoft docs and it has sam problem. the master page wrap the whole screen, also backbutton and humburger icon. but in microsoft docs pictures, behavior is different from running it sample Picture of your solution : you can see then Back button is not visible to user and master page wrap the whole screen.

    Thursday, April 2, 2020 7:30 AM
  • User382871 posted

    you can see then Back button is not visible to user and master page wrap the whole screen. Yes, but it's unnecessary to use the back button, you can return to the page by cliking the hardware back button or the gray space.

    Thursday, April 2, 2020 8:09 AM