How to insert special characters content in XAML?
May 9, 2009 Leave a comment
Suppose you want to have a button with that displays < Click Here >. Doing this the traditional way
<Button x:Name="btn"><Click Here></Button>
will drive you to troubles becuase the XAML parser will think that you want to create an element called Click with an attribute called here. Therefore, you need to encode the special characters in your code.
Less than (<) <
Greater than (>) >
Quotation mark (“) "
Ampersand (&) &
Therefore, you will instead need to write your statement as follows:
<Button x:Name=”btn”> <Click Here> </Button>