Xamarin Forms - Hide Burger Menu

自古美人都是妖i 提交于 2021-01-07 03:12:07

问题


Since the release of XF 3.2, it provided the ability to create your own custom TitleBar. This feature works well but I have a couple of problems that I am hoping someone can help me with.

I am trying to hide the Burger Menu icon, but so far I have not been able to.

I can hide the Back Button by doing the following:

NavigationPage.HasBackButton="False"

This does however still leave a slight vertical bar on the left side of the TitleBar, so if someone knows how to also remove that then great.

I was expecting the same code to also hide the Burger Menu icon but this is still present so I'm hoping someone can help me to remove this.

Alternatively, if anyone knows of a way I can either change the icon (to use my own) or to change the colour of it (as it is always white and I want it to be black), then that would be great.

Cheers...


回答1:


For anyone using Shell you can hide the hamburger button and implicitly disable the flyout menu using:

  • Globally inside AppShell (or whatever named), also you can change the hamburger icon
<Shell>
...
     FlyoutBehavior="Disabled"
     FlyoutIcon="flyouticon.png"
..
</Shell>
  • Or hide it only in some pages:
<ContentPage>
...
    Shell.FlyoutBehavior="Disabled"
</ContentPage>


来源:https://stackoverflow.com/questions/53340478/xamarin-forms-hide-burger-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!