I have an issue with setting custom font from code behind in Windows Store Apps (Windows 8.1, C#).
It is working in XAML
, but not in code behind. I have added my font *.ttf file to Assets. Set Build Action
= Content. I have set path to my font file like this:
<TextBlock Text="" FontFamily="ms-appx:///Assets/My-icons.ttf#My-icons"/>
It's working (displaying my icon), when I set text property in XAML
, but as soon as I set text to this TextBlock
in code behind or create new TextBlock
with the same properties in code behind - it's not working (displaying unicode).
Can anyone help me with this?
Does this help:
char ch = (char)0xF8FF;
YourTextBlock.Text = ch.ToString();