I have a class library (Imp.Dash.Cook) referenced by my main UWP app (Imp.Dash). In a page in said class library, I have the following XAML:
<TextBlock Text="Banana" FontFamily="/Imp.Dash;component/Fonts/Portmanteau Regular.ttf#Portmanteau"/>
<TextBlock Text="Banana" FontFamily="/Imp.Dash.Cook;component/Resources/Portmanteau Regular.ttf#Portmanteau"/>
<TextBlock Text="Banana" FontFamily="Resources/Portmanteau Regular.ttf#Portmanteau"/><!-- Works in Designer-->
<TextBlock Text="Banana" FontFamily="Fonts/Portmanteau Regular.ttf#Portmanteau"/>
In trying to change the font, only the third line has any bearing. The font is indeed changed, but only in the designer. On runtime, I get nothing. No errors in output or similar.
Does anyone have any ideas what I'm doing wrong, or how I can debug it?
The font is a .ttf located in the Resources
folder of my class library. It is set to Content
and Do not copy
. The latter has no bearing, even when set to Copy Always
. I've also tried placing it in the main project, under Fonts
.
I had a similar issue with image resources, but in this case it is not an embedded resource. (See UWP - Load image in class library)