Segoe MDL2 Assets字体家族中的丢失图标

时间:2019-09-11 21:15:58

标签: c# xaml fonts uwp icons

我正在尝试创建一个AppBarButton,其中icon属性是FontIcon,但是我要使用的特定图标不起作用;它显示为矩形。

我正在用C#创建一个UWP应用,并且试图从Segoe MDL2 Assets字体中创建一个带有QR Code(Unicode点ED14)图标的按钮,但是当我在图标的Glyph属性中输入图标标识符时FontIcon元素仅显示占位符矩形,就好像未安装字体一样。我在应用程序中使用的所有其他图标都可以正常工作,但是此图标没有出现。

我确保复制了工作按钮并仅更改了图标代码,但是它不起作用。我还尝试过将已知工作图标的代码放入损坏的按钮中,并且效果很好。在页面https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font上找到的QR Code图标似乎有问题。

有问题的按钮:

<AppBarButton Label="QR Codes" Click="{x:Bind NewExhibitionAsync}">
    <AppBarButton.Icon>
        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xED14;"/>
    </AppBarButton.Icon>
</AppBarButton>

完整的CommandBar:

<CommandBar>
    <AppBarButton Label="Open...">
        <AppBarButton.Icon>
            <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE8E5;"/>
        </AppBarButton.Icon>
    </AppBarButton>
    <AppBarButton Icon="Save" Label="Save" />
    <AppBarButton Label="Save as...">
        <AppBarButton.Icon>
            <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE792;"/>
        </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="&#xED14;"/>
        </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中时,如下图所示。

Icon displayed in command bar

有人知道如何使图标显示在Microsoft文档中吗?它看起来应该像这张图片。 (抱歉,信誉不足,无法正确发布图像。)

Goal

2 个答案:

答案 0 :(得分:0)

会发生此问题,表明您的系统版本可能较低。

Segoe MDL2 Assets是系统图标字体,随着系统更新而改变。 QR Code图标稍后出现,在较低版本的系统中不可用。

因此,请尝试更新您的系统。或将字体复制到较高版本的系统上,然后将其安装在较低版本的系统上

最诚挚的问候。

答案 1 :(得分:0)

只需在@Richard Zhang-MSFT中添加答案,如果您所支持的设备版本低于您要在应用中使用的字体图标或表情符号,则正确的解决方案可能是不使用这个特定的图标。取而代之的是,将BitmapIcon与图标的png版本一起使用,甚至最好将PathIcon与图标本身的SVG路径一起使用。

幸运的是,您可以找到许多适合的图标,这些图标可以与Icons8Syncfusion Metro Studio之类的服务一起在您的应用程序中在线使用。

对于表情符号,您可以在https://emojipedia.org/上查看版本支持。不幸的是,我不知道MDL2资产字体的类似来源。