MVVM:在UWP中使用带有XAML的自定义字体

MVVM:在UWP中使用带有XAML的自定义字体,xaml,mvvm,uwp,Xaml,Mvvm,Uwp,我试图在UWP应用程序中使用来自的图标字体 在我的XAML中,我有 <Grid.Resources> <FontFamily x:Key="WeatherFonts">/Assets/Fonts/weathericons-regular-webfont.ttf#Weather Icons</FontFamily> </Grid.Resources> <TextBlock x:Name="tbFontAwesome"

我试图在UWP应用程序中使用来自的图标字体

在我的XAML中,我有

<Grid.Resources>
  <FontFamily x:Key="WeatherFonts">/Assets/Fonts/weathericons-regular-webfont.ttf#Weather Icons</FontFamily>
</Grid.Resources>
<TextBlock x:Name="tbFontAwesome" 
               Text="{Binding CurrentWeather.Icon}" 
               FontFamily="{StaticResource WeatherFonts}" 
               Foreground="White" 
               FontSize="72"/>
如果我只是在XAML中硬编码,它就可以正常工作

<TextBlock x:Name="tbFontAwesome" 
               Text="&#xf00d;" 
               FontFamily="{StaticResource WeatherFonts}" 
               Foreground="White" 
               FontSize="72"/>


当我使用硬编码的XAML时,图标显示得很好,但是如果我尝试绑定到字符串,则
TextBlock
只显示字符串而不是图标。

尝试
System.Net.WebUtility.HtmlDecode(;”)
这很有效。我在这方面遇到了麻烦,但事实证明还有另一个问题。谢谢你的帮助。@Matthewterterrible nws。很高兴听到你成功了!
<TextBlock x:Name="tbFontAwesome" 
               Text="&#xf00d;" 
               FontFamily="{StaticResource WeatherFonts}" 
               Foreground="White" 
               FontSize="72"/>