Xamarin Forms - 隐藏汉堡菜单 [英] Xamarin Forms - Hide Burger Menu
问题描述
自 XF 3.2 发布以来,它提供了创建您自己的自定义标题栏的能力.此功能运行良好,但我遇到了一些问题,希望有人可以帮助我.
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"
NavigationPage.HasBackButton="False"
然而,这仍然会在 TitleBar 的左侧留下一个轻微的垂直条,所以如果有人知道如何也删除它,那就太好了.
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.
干杯...
推荐答案
对于使用 Shell 您可以使用以下方法隐藏汉堡按钮并隐式禁用弹出菜单:
For anyone using Shell you can hide the hamburger button and implicitly disable the flyout menu using:
- 在 AppShell(或其他任何名称)中的全局范围内,您也可以更改 汉堡包图标
<Shell>
...
FlyoutBehavior="Disabled"
FlyoutIcon="flyouticon.png"
..
</Shell>
- 或者仅在某些页面中隐藏它:
<ContentPage>
...
Shell.FlyoutBehavior="Disabled"
</ContentPage>
这篇关于Xamarin Forms - 隐藏汉堡菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!