Windows phone 在Universal App中使用资源中的FontIcon时发生XamlParseException
我试图在参考资料中为我在appbar中使用的按钮添加字体图标。代码如下:Windows phone 在Universal App中使用资源中的FontIcon时发生XamlParseException,windows-phone,appbar,win-universal-app,Windows Phone,Appbar,Win Universal App,我试图在参考资料中为我在appbar中使用的按钮添加字体图标。代码如下: <Page.Resources> <FontFamily x:Key="IconsFont">/Assets/iconfont.ttf#iconfont</FontFamily> <FontIcon x:Key="LogoutIcon" FontFamily="{StaticResource IconsFont}" Glyph="" Font
<Page.Resources>
<FontFamily x:Key="IconsFont">/Assets/iconfont.ttf#iconfont</FontFamily>
<FontIcon x:Key="LogoutIcon" FontFamily="{StaticResource IconsFont}" Glyph="" FontSize="35" />
</Page.Resources>
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Icon="Find" Label="search" Command="{Binding SearchCommand}" Visibility="{Binding SearchCommandVisibility}"/>
<AppBarButton Label="logout" Command="{Binding LogoutCommand}" Icon="{StaticResource LogoutIcon}" />
</CommandBar>
</Page.BottomAppBar>
/资产/iconfont.ttf#iconfont
在designer中,一切看起来都很好,图标显示正确。但是,当我启动应用程序时,我收到带有一般错误文本的XamlParseException:“未能分配给属性“%0”
如果我从资源中取出FontIcon,它也可以正常工作
有什么想法吗?试试看
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Icon="Find" Label="search"/>
<AppBarButton Label="logout">
<AppBarButton.Icon>
<FontIcon FontFamily="{StaticResource IconsFont}" Glyph="" FontSize="35"/>
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
</Page.BottomAppBar>
并从页面资源中删除
。这是可行的,但这不是我需要的。我需要在参考资料中保留图标。