Search code examples
c#xamarin.formsxamarin.androidxamarin.ios

Xamarin forms - Remove burger menu icon but keep nav bar


Remove burger icon

I'm wanting to remove the burger menu icon whilst retaining the navigation bar. I want to add content to the NavigationPage.TitleView property and i would like it to take the full width of the page. In the image i've attached, the yellow background colour shows the width that the TitleView is currently occupying.

I know in forms you can control the visibility of the back button, is there a way you can also control the burger menu icon? Based on what i've been reading, this will most likely require a custom renderer, which i've tried with no luck. I need to support iOS & Android.


Solution

  • As it turns out, at the moment, this is not possible. You can hide the burger menu but it still takes up space (see Leon Lu's answer).

    My solution was to create a custom navigation bar, that way i have full control. If you want to do this first remove the navigation bar:

    NavigationPage.SetHasNavigationBar(this, false);

    Then add your custom nav using regular xaml code, just like you would with any other component.

    One to thing to keep in mind is that in ios your nav can show where the notch is, to fix this you need to use this code:

    On<iOS>().SetUseSafeArea(true);