minimize the Height of the BottomAppBar in a unive

2019-02-28 20:19发布

问题:

I want to minimize the Height of the BottomAppBar this is my xaml code:

<Page.BottomAppBar >
    <CommandBar Background="#393185"
            Foreground="White" VerticalAlignment="Stretch" Style="{Binding Source={StaticResource Ellipsis}}" Height="40" MaxHeight="40" >
        <CommandBar.CommandBarOverflowPresenterStyle>
            <Style TargetType="CommandBarOverflowPresenter">
                <Setter Property="Background"
                    Value="#00a0e3" ></Setter>
                <Setter Property="Margin" Value="0"></Setter>
                <Setter Property="Padding" Value="0"></Setter>
                <Setter Property="BorderBrush" Value="Transparent"/>

            </Style>
        </CommandBar.CommandBarOverflowPresenterStyle>
        <CommandBar.PrimaryCommands>



            <AppBarButton Label="Cortana"
                      Icon="Microphone"
                      Foreground="White" />

        </CommandBar.PrimaryCommands>
        <CommandBar.SecondaryCommands >
            <AppBarButton Label="Info"
                      Foreground="White" Background="#00a0e3"/>
        </CommandBar.SecondaryCommands>
    </CommandBar>
</Page.BottomAppBar>

the "Ellepsis" Style is the default Style of the commandBar link but what I get is this result:

I get as a result the space that you can see in the image(in the top of the BottomAppbar)

which parameter should I change in this Style to minimise the Height of bottomAppBar whithout the white space that I get as a result

thanks for help

回答1:

You can set the properties if the MinHeight to be smaller (default is 60) so the white space is removed.

<x:Double x:Key="AppBarExpandButtonThemeHeight">48</x:Double>
<x:Double x:Key="AppBarThemeMinHeight">48</x:Double>