我对UWP应用程序中的CommandBar有一个问题(见下图)。

在这里,您可以看到CommandBar中的CompactMode和文本“TextBlock”的TextBlock。当我现在展开(点击这三个点) CommandBar时,TextBlock就消失了,如下所示:

我怎样才能防止TextBlock消失?
当我关闭展开的CommandBar时,它返回到状态,如图1所示,显示TextBlock。
“守则”:
<Grid x:Name="cmdBarDesktop" Grid.Row="0">
<CommandBar ClosedDisplayMode="Compact" IsOpen="True" IsSticky="True">
<CommandBar.PrimaryCommands>
<AppBarButton x:Name="AppBarListDesktop" Icon="List" Label="Listenform" Grid.Column="1" Click="AppBarList_Click" />
<AppBarButton x:Uid="AppBarAdd" Icon="Add" Label="Hinzufügen" Grid.Column="3" Click="AppBarAdd_Click" />
</CommandBar.PrimaryCommands>
</CommandBar>
</Grid>
<Grid x:Name="titleGrid" VerticalAlignment="Center" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="Hausaufgaben" Style="{StaticResource TitleTextBlockStyle}" Grid.Column="1" VerticalAlignment="Center" />
</Grid>发布于 2015-12-11 15:42:53
在的CommandBar控件中,您可以添加一个TextBlock。
<CommandBar ClosedDisplayMode="Compact">
<CommandBar.Content>
<TextBlock Text="Title" />
</CommandBar.Content>
<CommandBar.PrimaryCommands>
<AppBarButton Icon="List"
Label="Listenform" />
<AppBarButton Icon="Add"
Label="Hinzufügen" />
</CommandBar.PrimaryCommands>
</CommandBar>在这两种情况下,它都将解决您的问题。
https://stackoverflow.com/questions/34223691
复制相似问题