更改文本框FontFamily不会在Windows Phone 8.1中生效

时间:2014-12-01 11:14:45

标签: c# xaml windows-phone-8.1

我需要在我的应用程序中使用字体系列。我在App.Resources

中添加了以下代码段
 <FontFamily x:Key="SourceSanProFontFamily">Assets/Fonts/SourceSansPro-Regular.ttf#Source Sans Pro</FontFamily>

我将fontfamily应用于文本块。

 <TextBlock  Text="Welcomeg!"   FontFamily="{StaticResource SourceSanProFontFamily}"></TextBlock>

当应用程序没有运行时,它很好,我可以看到更改。但是当我运行应用程序时,它不会生效。

为什么会这样?如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

我们的联合力量设法解决了这个问题 - 在检查the working sample project之后,当其他 ResourceDictionaries 中声明了 FontFamily 时,它确定了/需要:

<FontFamily x:Key="SourceSanProFontFamily">/Assets/Fonts/SourceSansPro-Regular.ttf#Source Sans Pro</FontFamily>