为 BottomAppBar 定义高度,就像通用应用程序中的导航栏高度一样

define a Height for the BottomAppBar like the Navigation Bar Height in a universal App

我想像更改 NavigationBar 的高度一样更改 BottomAppBar 的高度,这是我的尝试:

    <Page.BottomAppBar>
        <CommandBar Background="#393185"
                Foreground="White" VerticalAlignment="Stretch" Style="{Binding Source={StaticResource Ellipsis}}" Height="40" MinHeight="40">
            <CommandBar.PrimaryCommands>

                <AppBarButton Label="Cortana"
                          Icon="Microphone"
                          Foreground="White"  
                               MinHeight="40" Height="40"/>
             </CommandBar.PrimaryCommands>
     </CommandBar>
</Page.BottomAppBar>

参考这篇文章:CommandBar style

这是我得到的结果:

如您所见,我在 Grid 和 BottomAppBar 之间留了一个空格 那么请问有什么方法可以删除这个保证金吗?? 感谢帮助

更新: 我在 CommandBarOverflowPresenter:Styles.xaml

中试过这样
             <CommandBarOverflowPresenter x:Name="SecondaryItemsControl"
                  Style="{TemplateBinding CommandBarOverflowPresenterStyle}"
                  IsEnabled="False"
                  IsTabStop="False">
                <CommandBarOverflowPresenter.RenderTransform>
                  <TranslateTransform x:Name="OverflowContentTransform"/>
                </CommandBarOverflowPresenter.RenderTransform>
                <CommandBarOverflowPresenter.ItemContainerStyle>
                  <Style TargetType="FrameworkElement">
                    <Setter Property="HorizontalAlignment" Value="Stretch"/>
                    <Setter Property="Width" Value="NaN"/>
                   <Setter Property="Margin" Value="0,-10,0,0"/>
                  </Style>
                </CommandBarOverflowPresenter.ItemContainerStyle>
              </CommandBarOverflowPresenter>

并且我已将高度和 tha MinHeight 设置为 40,如 this:Page1。xaml

<CommandBar Background="#393185"
                Foreground="White"Height="40" MinHeight="40">
            <CommandBar.CommandBarOverflowPresenterStyle>
                <Style TargetType="CommandBarOverflowPresenter">
                    <Setter Property="Background"
                        Value="#00a0e3" ></Setter>
                    <Setter Property="Margin" Value="0,-10,0,0"></Setter>
                </Style>
            </CommandBar.CommandBarOverflowPresenterStyle>
  </CommandBar>

但我总是遇到同样的问题,想念我的代码中的任何内容:( 再次感谢您的帮助

我试过:

<CommandBar Background="#393185" Foreground="White" VerticalAlignment="Stretch" Margin="0" Height="40" MinHeight="40" Padding="0" BorderThickness="0">

然而,当高度取值 40 时,Visual Studio 显示我的网格和我的命令栏之间的间隙。所以我认为这个控件有一个最小高度值,40低于这个最小值。