Tuesday, May 31, 2011

UniCode in XAML

A friend asked how to put a unicode into a Textblock from codebehind today.

After a bit of research I discovered it was quite easy;

string unicodeString = "This string contains the unicode character Pi (\u03a0)";

Just swap out the #x of you code for \u and you'll get your unicode character.