XAML 如何在UWP应用程序的紧凑模式下增加命令栏高度?

h79rfbju  于 2022-12-07  发布在  其他
关注(0)|答案(2)|浏览(92)

当命令栏的属性"ClosedDisplayMode"设置为"Compact"时,我想增加命令栏的高度。我甚至尝试过编辑默认样式,但我无法解决这个问题。请帮助我。I have added the image of the commandbar to resize

qnakjoqk

qnakjoqk1#

你的问题和它的标题是两个不同的东西,如果你想增加命令栏的高度,然后按照这个:

<Application.Resources>
   <x:Double x:Key="AppBarThemeCompactHeight">80</x:Double>
</Application.Resources>

如上一个答案所示,但如果您只想在应用处于紧凑模式时增加命令栏的高度,则必须使用如下所示的视觉状态:

<VisualStateManager.VisualStateGroups>
    <VisualStateGroup>
        <VisualState x:Name="Normal">
            <VisualState.StateTriggers>
                <AdaptiveTrigger MinWindowWidth="900"/>
            </VisualState.StateTriggers>
            <VisualState.Setters>
                <Setter Value="40" Target="{Themeresource AppBarThemeCompactHeight}"/>
            </VisualState.Setters>
        </VisualState>
        <VisualState x:Name="Mobile">
            <VisualState.StateTriggers>
                <AdaptiveTrigger MinWindowWidth="0"/>
            </VisualState.StateTriggers>
            <VisualState.Setters>
                <Setter Value="80" Target="{Themeresource AppBarThemeCompactHeight}"/>
            </VisualState.Setters>
        </VisualState>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>
wh6knrhe

wh6knrhe2#

在您的App.xaml页面中添加以下资源

<Application.Resources>
    <x:Double x:Key="AppBarThemeCompactHeight">80</x:Double>
</Application.Resources>

现在将增加高度。默认高度为48,您可以根据需要更改

相关问题