Forum Xamarin.Forms

Showing Navigation Bar instead of Back Button within a detail page

tschennietschennie USMember ✭✭
edited October 2017 in Xamarin.Forms

I chose a Master Detail Page as main page. My detail pages are content pages.
If the user is on the first/start page and clicks a button, another page will be pushed via Navigation.PushAsync(). On this page, normally the back button will be shown. But I don't need the back button there. I need the navigation icon to open the menu.
How can I do this? I just know that I can dispose th back button..
Setting NavigationPage.HasNavigationBar to true doesn't change anything..

And how can I prevent the users from clicking the back button from their smartphone?

Best Answer


  • DarshanJSDarshanJS USMember ✭✭✭✭
    edited October 2017

    In your masterdetail page in button click event write below code

      Detail = new NavigationPage(new nextpage());
                IsPresented = false;
  • tschennietschennie USMember ✭✭

    I have this code already, but it doesn't work..
    Any other suggestions?

  • NMackayNMackay GBInsider, University mod


    The MasterDetail hamburger behavior is strange, in your scenario you do a navigation from your detail page, the hamburger will disappear in android and a back button will be shown but you can still swipe right and get at the Master page, in iOS it behaves differently

    We push a modal page is you want to handle the user trying to navigate back. It's not ideal but MasterDetail has some limitations.

  • DarshanJSDarshanJS USMember ✭✭✭✭

    @tschennie said:

    try this code

    NavigationPage.HasNavigationBar = true
    NavigationPage.HasBackButton = False

    i believe it will work

  • tschennietschennie USMember ✭✭

    So, is there a possibility to navigate/show another page instead of pushing? Or set another page as detail page?

  • Gigex42Gigex42 USMember ✭✭✭✭
    edited October 2017

    You can always change the detail page. Look at this.

    Hope this helps

  • tschennietschennie USMember ✭✭

    I mean changing the detail page when I'm on another page and not from the main page..

  • Gigex42Gigex42 USMember ✭✭✭✭

    So when the user is on the last page, he shouldnt be able to go back to the previous page? Because the backbutton of the navigationpage wont be your only problem then because of the hardware back button.

    I dont know if this works but could you pop the previous page from the navigation stack?

  • Mayur534Mayur534 Member ✭✭

    @tschennie Did you find a solution to this ? I am also facing the same problem in one of my app

  • ArvindrajaArvindraja INMember ✭✭✭
    edited November 2018

    @tschennie - This should have served your purpose.

    Detail = new NavigationPage(new nextpage());
    IsPresented = false;

    This became issue for me. I want back arrow after pushing first Page. How you was pushing first ContentPagew/o using above code or by using PushAsync. Thank you.

  • divyagarimelladivyagarimella Member ✭✭✭

    back navigation button doesn't work for my modal navigation pages in xamarin forms .any one have idea?

Sign In or Register to comment.