在XAML UWP中更改底部AppBar的高度

Yea*_*iam 3 xaml uwp uwp-xaml

有没有办法降低AppBarXAML UWP 中Bottom的高度?我有以下XAML代码:

<Page.BottomAppBar>
    <CommandBar Height="35">
        <CommandBar.SecondaryCommands>
            <AppBarButton Label="Share"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
            <AppBarButton Label="Settings"/>
        </CommandBar.SecondaryCommands>
    </CommandBar>
</Page.BottomAppBar>
Run Code Online (Sandbox Code Playgroud)

问题是,当我将高度设置为35或低于50时,我会在底部AppBar上方看到一个额外的空白区域.如果我使用黑色或蓝色作为背景颜色,则该空白区域呈现白色

看屏幕截图

Jus*_* XL 6

解决此问题的最简单方法是覆盖App.xaml.cs文件中相应的主题资源.

<Application
    x:Class="MyApp.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyApp"
    RequestedTheme="Light">

    <Application.Resources>
        <x:Double x:Key="AppBarThemeCompactHeight">35</x:Double>
    </Application.Resources>
</Application>
Run Code Online (Sandbox Code Playgroud)

我发现这个预定义的资源的方式是,首先,我用Google搜索了默认StyleCommandBar,然后我基本上只是经历,发现都与那些高度.