I've been trying to use a TTF font in a WPF UserControl Library. Say I define a resource dictionary containing all of my fonts like this:
FontStyles.xaml
<ResourceDictionary ...>
<FontFamily x:Key="Ubuntu">Fonts/#Ubuntu</FontFamily>
</ResourceDictionary>
And then try to reference them in a master style dictionary, like this:
Styles.xaml
...
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="FontStyles.xaml"/>
...
</ResourceDictionary.MergedDictionaries>
<Style TargetType="TextBlock" x:Key="UbuntuExampleText">
<Setter Property="FontFamily" Value="{StaticResources Ubuntu}">
</Style>
If I then create a TextBlock with that Key, it loads the font correctly when I run my application, however, when I am previewing my UserControl in the Designer, it uses the default font. Is there a way to fix this? I haven't had this issue with images for some reason, just fonts.
I've even tried to keep my Font URIs simple to rule out a formatting issue.