1

I am attempting to use font 'Segoe MDL2 Assets' glyphs in a c# WinUI desktop program. Microsoft docs specify this:

You can assign a value from the Symbol enumeration, or a Unicode string that references a glyph in the Segoe MDL2 Assets font. You can use the Character Map application that comes with Windows to browse the font's glyphs and find their Unicode values. Then, use the format "&#x/(UNICODE);" in XAML.

I selected the 'check mark' as a test: U+E001

enter image description here

<Button x:Name="buttonGlyph" ToolTipService.ToolTip="delete" BorderBrush="Transparent" >&#x/U+E001;</Button>

The line won't compile, I get the error 'Invalid character in hexadecimal character entity...'

Have I entered &#x/U+E001; incorrectly?

Thanks!

2
  • Have you tried &#xe001. But your code sample is not complete, you should show the code referencing the font. You must add it as a resource or at the very least specify the FontFamily property of a TextBlock in the button. Commented Mar 29, 2022 at 3:33
  • Thank you NWoodsman, that worked! Thank you for showing me how to enter the unicode value properly. I did have to specify the FontFamily in the control, I did not need to add it as a resource. Thank you again so much. Commented Mar 29, 2022 at 5:12

1 Answer 1

1
<Button>
    <Button.Content>
        <TextBlock FontFamily="Segoe MDL2 Assets">&#xe001</TextBlock>
    </Button.Content>
</Button>

Or a cleaner way:

<Button>
    <Button.Content>
        <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE001;"/>
    </Button.Content>
</Button>


I don't have the font to properly specify the name, so I guessed at it. If the font is installed on your system and you type the name correctly in the FontFamily attribute, this should resolve.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.