Reputation: 1522
I'm using this code in a Grid
inside a Page
to make my TextBlock
use a custom font from /fonts/pirulen rg.ttf.
<TextBlock HorizontalAlignment="Left" Margin="617,49,0,0" Text="I Am the New Font" FontFamily="fonts/pirulen rg.ttf#Pirulen Rg" />
The font style is recognized when this Textblock is opened in the Property editor, but not so in the designer and neither when the app is running (it defaults to existing font from the system's font collection).
The build action of pirulen rg.ttf is set to 'Content'. What am I missing here ?
Upvotes: 0
Views: 271
Reputation: 4115
Try to set FontFamily to /fonts/pirulen rg.ttf#Pirulen Rg
. Notice the leading '/'. Basically relative paths are relative to location of your XAML file, so unless your XAML file is in the root you should start your asset paths with '/'.
Upvotes: 2