如何使用引用” XAML 绑定中的字符?

发布于 2024-08-03 10:15:53 字数 261 浏览 3 评论 0原文

我正在尝试这样做:

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

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷了相思 2024-08-10 10:15:53

您有两个选择:

""{0}""
'"{0}"'

此处对此进行了解释:http://msdn.microsoft.com /en-us/library/ms748250.aspx

在您的示例中(我一开始看不到您想要做什么),您可能想要执行以下操作:

...='"{0}"'

You have two options:

""{0}""
'"{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:

...='"{0}"'
一瞬间的火花 2024-08-10 10:15:53

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

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

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

<TextBlock Text="{Binding Path=clouds.all, StringFormat=\{0\}%}"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文