Special characters in XAML
XAML files are a form of XML. As such, they have to follow the rules of XML. There is one XML rule that can cause trouble when working with strings within attributes in XAML, known as special character.
XAML files are a form of XML. As such, they have to follow the rules of XML. I suspect that most of you are comfortable with those rules. Why wouldn't you? XML has been omnipresent within applications for a long time.
There is one XML rule that can cause trouble when working with strings within attributes in XAML. I'm referring to the special character problem. XML reserves some characters for its own use. The less than sign (<), greater than sign (>), ampersand (&), apostrophe (') and double quote (") have special meaning within an XML file. Therefore, if you want to use these reserved characterss within a Text property or Content property, you need to use the XML escape characters.
Reserved Escaped < < > > & & ' &apos " "
Using Unicode characters
Text in WPF is always stored as Unicode. Adding extended characters (ones that are not on your keyboard) is easily done in XAML. Just learn this special Unicode syntax . For example, what if you need to add a few Greek characters to your text (π λ)? A quick trip to the Windows Character Map utility shows that Pi is HEX 03C0 (or 960 decimal).
So, in XAML the π symbol is rendered with π
Here is an example of the techniques in this tip.