CommandBar新模板工作室

时间:2017-07-04 08:06:48

标签: uwp app.xaml

我希望将CommandBar放在桌面和移动设备的顶部,在新模板UWP Ppero的底部,当桌面上的这个没有退出COOMND栏时,移动设备不会离开上层Commndbar enter code here  enter code here

    <Grid.RowDefinitions>
        <RowDefinition x:Name="TitleRow" Height="48"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

 `enter code here`   <TextBlock
        x:Name="TitlePage"
        x:Uid="Main_Title"
         FontSize="{StaticResource FontSizeMedium}" Foreground="{StaticResource RedBrush}" FontWeight="SemiLight" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" VerticalAlignment="Center"
        Margin="0,0,12,7"/>

 `enter code here`   <CommandBar x:Name="Topbar" Margin="0,0,12,7"  HorizontalAlignment="Right"  Background="White" Visibility="Collapsed"  >
        <CommandBar.PrimaryCommands>
            <AppBarButton  x:Name="AddButton" Icon="Accept" x:Uid="Aceptar"  Foreground="{StaticResource RedBrush}" Click="AddButton_Click"/>
        </CommandBar.PrimaryCommands>
    </CommandBar>

1 个答案:

答案 0 :(得分:0)

由于您已经在使用VisualStates,因此您的网格中可以有三行,只需使用CommandBar更改Grid.Row的{​​{1}}值即可应用程序的宽度。

Here is a video of the example code below at run-time

更新

要重复我在上一条评论中所说的内容,您不再需要使用&#34; Page.AppBar&#34;属性。事实上,您不想使用它,因为您的网格AdaptiveTrigger无法改变网页级属性。

相反,你可以做我在下面显示的内容(它是一个完整的,有效的例子):

VisualStateManager

当应用程序在移动设备上时,屏幕宽度将小于640epx,CommandBar将位于底部。否则,它将位于顶部。

相关问题