c# - 在 CommandBar 的 SecondaryCommand 上设置图标

标签 c# visual-studio-2015 uwp windows-10-mobile

我有一个命令栏宽度辅助命令:

<CommandBar>
    <AppBarButton Icon="Back" Label="Back" Click="AppBarButton_Click"/>
    <AppBarButton Icon="Stop" Label="Stop" Click="AppBarButton_Click"/>
    <AppBarButton Icon="Play" Label="Play" Click="AppBarButton_Click"/>
    <AppBarButton Icon="Forward" Label="Forward" Click="AppBarButton_Click"/>

    <CommandBar.SecondaryCommands>
        <AppBarButton Icon="Like" Label="Like" Click="AppBarButton_Click"/>
        <AppBarButton Icon="Dislike" Label="Dislike" Click="AppBarButton_Click"/>
    </CommandBar.SecondaryCommands>
</CommandBar>

为什么不显示“喜欢”和“不喜欢”图标?

最佳答案

在 Windows 8.1 中,主要和次要命令是一种将按钮放在左侧和右侧的方法。在 Windows 10 UWP 中,辅助命令被移动到桌面和手机上的弹出菜单中。默认情况下,图标不显示在此弹出菜单中。

The SecondaryCommands collection can contain only AppBarButton, AppBarToggleButton, or AppBarSeparator command elements. The secondary commands are shown in the overflow menu when the CommandBar is open.

来源:MSDN .

如果您想尝试覆盖该样式,请查看 generic.xaml 中的 OverflowPopup 控件和 CommandBarOverflowPresenter 样式以帮助您入门。

C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.10240.0\Generic\generic.xaml

关于c# - 在 CommandBar 的 SecondaryCommand 上设置图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34342022/

相关文章:

c# - 在 C# 中寻找一个简单的独立持久字典实现

c# - 如何处理 XmlReader.Create 的异常

windows - ucrtbase.dll : An invalid parameter was passed to a function that considers invalid parameters fatal

visual-c++ - 在命令行上编译 C++/CX

c# - UWP - 旋转图像,同时保持其与网格对齐,仅使用 XAML

c# - 使用 Union 的匿名类型错误

c# - Designer 在 InitializeComponent 中创建一些字段而不是创建全局变量

c# - ClickOnce 部署恐怖

dialog - uwp - 如何根据内容调整ContentDialog的大小?

Javascript:监听回调返回