WPF Fonts in a ResourceDictionary
I'm trying to create a styling folder (Not sure if "library" is the right term here) for my WPF application, and inside this folder I'm attempting to add a complete folder of otf/ttf files as fonts to my resource dictionaries in order to use them in my application by
{StaticResource MyFontKeyHere}
Does anyone know how I can achieve this?1 Reply
Before and after. It seems that my current approach is not working as intended.
I have my
/Styles/Fonts.xaml
file that currently contains this:
<FontFamily x:Key="RnC">./Fonts/RnC-Demo.otf#RnC Sans</FontFamily>
And in my MainWindow.xaml
I am trying to reach it as follows:
<Button x:Name="BtnAdd" Margin="0,5,0,0" Click="BtnAdd_OnClick" FontFamily="{StaticResource RnC}">Add Name</Button>