如何在 Xamarin.Forms UWP 中隐藏默认工具栏按钮(三个点)

How do I hide the default toolbar button (three dots) in Xamarin.Forms UWP

我有一个 Xamarin.Forms UWP 应用,其中 <ContentPage.ToolbarItems> 定义了两个 toolbarItem。 在 UWP 中,此工具栏呈现但显示一个带有 3 个点的额外(或默认)按钮,该按钮展开但不包含任何按钮。我想删除这个多余的按钮。

我找到了一些关于这个问题的参考资料,但它们对我不起作用:

根据您在 post 中提到的 link 中的答案,您是否尝试将以下代码放入 UWP 项目的 App.Xaml 中:

<Application.Resources>
   <x:Double x:Key="AppBarExpandButtonThemeWidth">0</x:Double>
</Application.Resources>

自 Windows 10 周年纪念版(因此您的项目的最低版本为 14393,目标版本为 14393 或更高)CommandBar 上有一个 属性,您可以使用它来切换可见性3 dots/more 按钮。

它叫 OverflowButtonVisibilty,文档在这里: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.commandbar.overflowbuttonvisibility

可以这样设置

<CommandBar OverflowButtonVisibility="Collapsed"></CommandBar>