如何在XAML绑定中使用引号 " 字符?

22
我正在尝试做这件事:
<TextBlock Text="{Binding Path=Text, 
           Converter={StaticResource stringFormatConverter}, 
           ConverterParameter='\"{0}\"'}" />

但是这显然不是将引号嵌入XAML绑定字符串的正确方法。

应该如何使 "\"{0}"\" 在这里正常工作?


是的,现在你可以看到代码了。 - Alex Baranosky
2个回答

33

0

在Windows Phone中,我在绑定文本后添加了“%”。

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

但是你不加引号。这有什么帮助吗? - ANeves
1
对于那些想要使用此处提供的StringFormat方法获取引号文本的人,这将提供带引号的文本<TextBlock Text="{Binding Path=my_string, StringFormat='"{0}"'}"/> - Tim Holt

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接