How to put a unicode character in XAML?

Alex Baranosky picture Alex Baranosky · Sep 2, 2009 · Viewed 68.9k times · Source

I'm trying to do this:

<TextBlock Text="{Binding Path=Text, 
                          Converter={StaticResource stringFormatConverter}, 
                          ConverterParameter='&\u2014{0}'}" />

To get a — to appear in front of the text. It doesn't work. What should I be doing here?

Answer

ferdley picture ferdley · Sep 2, 2009

Since XAML is an XML file format you could try the XML character escape. So instead of writing &\u2014, you could write &#x2014; instead.