Alan2
Alan2

Reputation: 24572

How can I show an ampersand in XAML text string?

I am trying to add an ampersand like this:

<Label Text="Phrase & Meaning Visible" />

This doesn't work so I tried to delimit with a \ and that also does not work. Does anyone have any suggestions on how I can do this?

Upvotes: 6

Views: 5200

Answers (2)

Ronald Korze
Ronald Korze

Reputation: 828

Actually this question is not about XAML, it's just a pure XML question. Some characters need to be escaped in XML, the correct escaping of & is &amp;

Upvotes: 19

Paramjit
Paramjit

Reputation: 860

Taken this with thanks from the following blog post. Special Symbols in XAML

For Ampersand sign <Label Text="&amp;"/>
For less than sign <Label Text="&lt;">
For greater than sign <Label Text="&gt;"/>
For double quotes <Label Text="&quot;"/>

Upvotes: 10

Related Questions