In my XAML file I want to display this text which contains double and single quotation marks:
You shouldn't choose "Copy if New".
None of these work:
<TextBlock Text="You shouldn't choose "Copy if New":"/> <TextBlock Text="You shouldn't choose ""Copy if New"":"/> <TextBlock Text="You shouldn't choose \"Copy if New\":"/> <TextBlock Text='You shouldn't choose \"Copy if New\":'/> <TextBlock Text='You shouldn\'t choose \"Copy if New\":'/>
I give up, can I do this in XAML?
The short answer is to use & to encode an ampersand.
You should encode the special characters:
<TextBlock Text='You shouldn't choose "Copy if New":'/>
'
for '
"
for "
There are defined XML escapes &
"
for " and &
'
for ' -- if the XML handling in XAML
doesn't interpret those properly, then start to worry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With