Currently, I have a class library project that contains themes/templates and fonts (as resources). I am then referencing that project, named Shared.UI, in my main WPF application project.
I am referencing it using the:
<ResourceDictionary Source="pack://application:,,,/Shared.UI;component/Skin.xaml" />
within a MergedDictionary tag.
The issue that I'm having is that the main WPF application isn't able to use the fonts from the project where they are built as resources.
In my Shared.UI/Skins.xaml file, I have:
<!-- LABEL -->
<Style TargetType="{x:Type Label}">
<Setter Property="FontFamily" Value="./resources/#Helvetica Neue" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryBlue}" />
<Setter Property="FontSize" Value="12" />
</Style>
I assume that this isn't working in my main WPF application because it looks in its own ./resources
for the #Helvetica Neue
and fails to find it (because it's in Shared.UI). I tried to also explicitly reference the /Shared.UI;component/resources/#Helvetica Neue
within the resource file but that didn't work for me.
Check this link, hope it helps http://social.msdn.microsoft.com/Forums/vstudio/en-US/068d9600-93e6-45e4-af37-2b04e4b41855/how-to-load-a-font-from-a-resource-only-dll-in-c
<TextBlock><Run FontFamily="/FontClassLibrary;Component/#YourFontName" FontSize="20">Your Text</Run></TextBlock>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With