UWP命令栏“更多”按钮不显示,除非大小更改

UWP命令栏“更多”按钮不显示,除非大小更改,uwp,win-universal-app,Uwp,Win Universal App,我的问题几乎和你的问题一样 我的CommandBar应该有以下按钮: <CommandBar DefaultLabelPosition="Right" Style="{StaticResource PlaylistCommandBarStyle}"> <AppBarButton Icon="Shuffle" Style="{StaticResource PlaylistAppBarButtonStyle}" />

我的问题几乎和你的问题一样

我的
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>

这很复杂。我想知道是否有更简单的解决办法

播放应用程序按钮样式是


播放列表CommandBarStyle
是。

命令栏的溢出按钮有两个条件

首先,屏幕宽度不足以显示完整的按钮列表

第二个是
CommandBar。SecondaryCommands
不是空的

您可以尝试将不重要的按钮移动到
secondary commands
列表中



致以最诚挚的问候。

这可能是一个解决方案。但是我能问一下为什么调整大小会使“更多”按钮出现吗?等等……实际上我的“清除”按钮和“删除”按钮是可选的,所以它们并不总是可见的。如果我把它们放在
第二个命令中
,溢出按钮仍然会在那里,即使应该什么都没有。这是命令栏的设计。您可以理解,当宽度变窄时,溢出控件将自动移动到
secondary命令
,以便显示溢出按钮,因为
secondary命令
不是空的。至于你说的按钮是可选的,我想你可以通过调整
命令栏来调整溢出按钮的显示。当状态改变时,溢出按钮的可视性
。我理解你的意思。但实际上,当我将窗口的大小调整一点点时,溢出按钮会立即显示出来。我只是不明白为什么调整一点大小会让它出现。溢出按钮的过程是动态的。当您尝试放大软件的宽度时,
CommandBar
将判断当前控件宽度是否可以容纳按钮。您可能想知道,为什么溢出按钮出现后,软件宽度会立即增大,但按钮不会立即出现。这是因为此时
命令栏
预测的按钮宽度实际上应该是
第二命令
中的
弹出项
的宽度,该宽度可能比实际按钮宽,从而导致行为不一致。