Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Unicode characters in C# controls

Tags:

c#

unicode

xaml

I want to add the Greek letter omega (U+03A9) to a label I've placed on the form. I've already switched the encoding of the form, but how do I set the content of the label such that an omega appears and not UTF char code.

So taking this XAML

<Label Height="25">U+03A9</Label>

I want the U+03A9 to be converted to an omega

in the code behind I believe I can do something like

targetEncoding = Encoding.getEncoding(utfEncoding);
lblOmega.Content = targetEncoding.getBytes("\u03A9");

But I'm wondering if I can do this strickly in the XAML

like image 975
Scott Avatar asked Jan 26 '10 15:01

Scott


1 Answers

Simply add the literal symbol Ω as the control's text. No futher modification necessary.

lblOmega.Text = "Ω";
like image 195
George Johnston Avatar answered Oct 12 '22 18:10

George Johnston