我的问题几乎与here相同。
我的CommandBar
应该具有以下按钮:
<CommandBar
DefaultLabelPosition="Right"
Style="{StaticResource PlaylistCommandBarStyle}">
<AppBarButton
Icon="Shuffle"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<AppBarButton
Icon="Add"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<AppBarButton
Icon="Rename"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<AppBarButton
Icon="Pin"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<AppBarButton
Icon="Clear"
Style="{StaticResource PlaylistAppBarButtonStyle}"
Visibility="Collapsed" />
<AppBarButton
Icon="Delete"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
</CommandBar>
当窗口的大小不足以容纳最后一个删除按钮时,它将溢出,然后显示更多按钮。但是,除非我调整窗口大小,否则不会显示more按钮。
答案here非常复杂。我想知道是否有更简单的解决方案。
[PlaylistAppBarButtonStyle
是here。
[PlaylistCommandBarStyle
是here。
CommandBar的溢出按钮有两个条件。
首先是屏幕宽度不足以显示完整的按钮列表。
第二个是CommandBar.SecondaryCommands
不为空。
您可以尝试将不重要的按钮移到SecondaryCommands
列表中。
<CommandBar
DefaultLabelPosition="Right"
Style="{StaticResource PlaylistCommandBarStyle}">
<AppBarButton
Icon="Shuffle"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<AppBarButton
Icon="Add"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<AppBarButton
Icon="Rename"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<AppBarButton
Icon="Pin"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
<CommandBar.SecondaryCommands>
<AppBarButton
Icon="Clear"
Style="{StaticResource PlaylistAppBarButtonStyle}"
Visibility="Collapsed" />
<AppBarButton
Icon="Delete"
Style="{StaticResource PlaylistAppBarButtonStyle}" />
</CommandBar.SecondaryCommands>
</CommandBar>
最诚挚的问候。