【发布时间】:2014-06-06 16:08:21
【问题描述】:
我正在尝试将我在 appbar 中使用的按钮的 FontIcons 放在资源中。代码如下:
<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>
在设计器中看起来一切正常,图标显示正确。但是当我启动应用程序时,我收到带有通用错误文本的 XamlParseException:“无法分配给属性 '%0'”
如果我将 FontIcon 从资源中取出,它也可以正常工作。
有什么想法吗?
【问题讨论】:
标签: windows-phone appbar win-universal-app