tags:

views:

185

answers:

2

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?

+2  A: 

You should encode the special characters:

<TextBlock Text='You shouldn&apos;t choose &quot;Copy if New&quot;:'/>
Julien Poulin
A: 

There are defined XML escapes &quot; for " and &apos; for ' -- if the XML handling in XAML doesn't interpret those properly, then start to worry.

Steve Gilham