使用标记扩展时如何转义逗号?
我正在使用的标记扩展的第二个参数的值是一个包含一些逗号的字符串,我不希望这些逗号被 xaml 解释器/解析器解释为参数分隔符,但整个字符串本身包括逗号被用作值。
这是一个例子:
<SomeControl SomeProperty="{Wpf:MyExtension MyFirstParameter,
MySecondParameter, being a string, containing some commas.}" />
Google没有帮助,我发现了一些类似的问题,但没有一个适用于这个问题:
The value of the second parameter of the markup extension I am using is a string containing some commas and I don't want those commas to be interpreted as parameter separators by the xaml interpreter / parser, but that the whole string as such including the commas is used as value.
Here is an example:
<SomeControl SomeProperty="{Wpf:MyExtension MyFirstParameter,
MySecondParameter, being a string, containing some commas.}" />
Google didn't help, I found some similar issues but none apply to this problem:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以使用单引号来封装字符串;因此您的标记应类似于:
我不确定您是否还需要
{}
转义序列标记。You can use single quotes to encapsulate a string; so your mark-up should look something like:
I'm not sure whether you will also need the
{}
escape sequence mark-up.