Hhry
Hhry

Reputation: 913

UWP: x:Bind does not handle font icon correctly

I'm try to pass my Icon text through x:Bind Icon like this

X:Bind Icon is enter image description here

<ui:ButtonWithIcon IconContent="{x:Bind Icon}"
                   Content="{x:Bind Name}"
                   Margin="0,20,0,0"
                   Style="{StaticResource RoundFontButtonStyle}"/>

However, It gave me this result:
enter image description here
If I change the code to this, the font icon do show correctly:

<ui:ButtonWithIcon IconContent="&#xE1D3;"
                   Content="{x:Bind Name}"
                   Margin="0,20,0,0"
                   Style="{StaticResource RoundFontButtonStyle}"
                  />

enter image description here

What am I doing wrong?

Upvotes: 1

Views: 111

Answers (1)

Anran Zhang
Anran Zhang

Reputation: 7727

&#xE1D3; is a XAML escape character, that is, it is just an expression in XAML.

In C#, as a unicode character, it can be written like this:

Name = "\uE1D3";

Upvotes: 1

Related Questions