【发布时间】:2019-09-11 21:15:58
【问题描述】:
我正在尝试创建一个 AppBarButton,其中图标属性是 FontIcon,但我要使用的特定图标不起作用;它显示为一个矩形。
我正在 C# 中创建一个 UWP 应用程序,我正在尝试使用 Segoe MDL2 Assets 字体中的 QR 码(Unicode 点 ED14)图标创建一个按钮,但是当我将图标标识符输入到 Glyph 属性中时FontIcon 元素它只是显示占位符矩形,就好像没有安装字体一样。我在我的应用中使用的所有其他图标都可以正常工作,但这个图标没有出现。
我确保复制工作按钮并简单地更改图标代码,但它不起作用。我还尝试将已知工作图标的代码放入损坏的按钮中,效果很好。此页面https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font上的二维码图标似乎有问题。
有问题的按钮:
<AppBarButton Label="QR Codes" Click="{x:Bind NewExhibitionAsync}">
<AppBarButton.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph=""/>
</AppBarButton.Icon>
</AppBarButton>
完整的命令栏:
<CommandBar>
<AppBarButton Label="Open...">
<AppBarButton.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph=""/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Icon="Save" Label="Save" />
<AppBarButton Label="Save as...">
<AppBarButton.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph=""/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarSeparator/>
<AppBarButton Icon="Add" Label="New Exhibition" Click="{x:Bind NewExhibitionAsync}"/>
<AppBarButton Label="QR Codes" Click="{x:Bind NewExhibitionAsync}">
<AppBarButton.Icon>
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph=""/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Label="Set Primary Photo" Click="{x:Bind SetStarred}" IsEnabled="{x:Bind SetStarredEnabled, Mode=OneWay}">
<AppBarButton.Icon>
<SymbolIcon Symbol="SolidStar" Foreground="Goldenrod"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarSeparator/>
<AppBarButton Icon="Delete" Label="Delete" Click="{x:Bind DeleteArtefactAsync}" IsEnabled="{x:Bind DeleteArtefactEnabled, Mode=OneWay}"/>
<AppBarButton Icon="Edit" Label="Edit" Click="{x:Bind EditArtefactAsync}" IsEnabled="{x:Bind EditArtefactEnabled, Mode=OneWay}"/>
</CommandBar>
上面的代码当前在放入CommandBar时显示如下图。
有没有人知道如何让图标显示在 Microsoft 文档中?它应该看起来像这个图像。 (抱歉,没有足够的声誉来正确发布图片。)
【问题讨论】: