19

我正在尝试这样做:

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

但这显然不是在 XAML 绑定字符串中获取引号的方法。

让 "\"{0}"\" 在这里工作的适当方法是什么?

4

2 回答 2

31

你有两个选择:

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

这在这里解释:http: //msdn.microsoft.com/en-us/library/ms748250.aspx

在你的例子中(我一开始看不到你想要做什么),你可能想要做:

...='&quot;{0}&quot;'
于 2009-09-02T11:28:47.557 回答
0

这里我在windows phone中绑定文本后添加“%”。

<TextBlock Text="{Binding Path=clouds.all, StringFormat=\{0\}%}"/>
于 2015-10-28T07:07:52.970 回答