Alex Baranosky
Alex Baranosky

Reputation: 50094

How to use quote " character in XAML binding?

I'm trying to do this:

<TextBlock Text="{Binding Path=Text, 
           Converter={StaticResource stringFormatConverter}, 
           ConverterParameter='\"{0}\"'}" />

But this is apparently not the way to get a quote into a XAML binding string.

What is the appropriate way to get "\"{0}"\" to work here?

Upvotes: 22

Views: 10885

Answers (2)

reza.cse08
reza.cse08

Reputation: 6178

Here I add "%" after binding text in windows phone.

<TextBlock Text="{Binding Path=clouds.all, StringFormat=\{0\}%}"/>

Upvotes: 0

Daniel Martin
Daniel Martin

Reputation: 23548

You have two options:

"&quot;{0}&quot;"
'"{0}"'

This is explained here: http://msdn.microsoft.com/en-us/library/ms748250.aspx

In your example (I couldn't see what you were trying to do at first), you'll probably want to do:

...='&quot;{0}&quot;'

Upvotes: 34

Related Questions