【转】在 XAML 的属性中,转义大括号 {}

时间:2023-03-10 01:43:57
【转】在 XAML 的属性中,转义大括号 {}

我们知道大括号“{}”在XAML中是用来处理标记扩展的。

比如:

<Button Content="{Binding}"/>

 

但如何转义而表示普通大括号的字符串呢?

比如:

<Button Content="{these are braces}, {Others}"/>

这样写会编译失败:值不是有效的 MarkupExtension 表达式。

 

正确的写法是:

<Button Content="{}{these are braces}, {Others}"/>

 

来源:http://www.cnblogs.com/zhouyinhui/archive/2009/07/16/1524717.html