简体   繁体   English

Xamarin Forms - 隐藏汉堡菜单

[英]Xamarin Forms - Hide Burger Menu

Since the release of XF 3.2, it provided the ability to create your own custom TitleBar.自 XF 3.2 发布以来,它提供了创建您自己的自定义标题栏的能力。 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" NavigationPage.HasBackButton="假"

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.然而,这仍然会在 TitleBar 的左侧留下一个轻微的垂直条,所以如果有人知道如何也删除它,那就太好了。

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...干杯...

For anyone using Shell you can hide the hamburger button and implicitly disable the flyout menu using:对于使用Shell 的任何人,您都可以隐藏汉堡按钮并使用以下方法隐式禁用弹出菜单:

  • Globally inside AppShell (or whatever named), also you can change the hamburger icon在 AppShell(或其他任何名称)中,您也可以更改汉堡包图标
<Shell>
...
     FlyoutBehavior="Disabled"
     FlyoutIcon="flyouticon.png"
..
</Shell>
  • Or hide it only in some pages:或者仅在某些页面中隐藏它:
<ContentPage>
...
    Shell.FlyoutBehavior="Disabled"
</ContentPage>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM