{}括号在Binding语法的StringFormat部分中是什么意思? [英] What do the {} brackets mean in the StringFormat section of a Binding syntax?
问题描述
在数据绑定中,您可以使用多重绑定..通过多重绑定,您可以组合诸如{} {0} {1}之类的属性。我的问题是第一个{}是什么意思?我不是在谈论{0},它是用来选择要使用的属性的。。
In data-binding you can use multi-binding.. and with multi-binding you can combine properties such {}{0} {1}. My question is what mean the first {} ? I am not talking about {0} which is used to select which property to use..
谢谢。
推荐答案
这是标记扩展{}的转义序列:
使用转义序列({}),以便将大括号({)用作文字
The escape sequence ({}) is used so that an open brace ({) can be used as a literal character in XAML.
详细说明:在XAML标记中, {
和}
是特殊字符:例如,编写 {Binding}
创建一个Binding对象。但是,您想将属性 StringFormat
设置为 literal 值 {0} {1}
。因此,您可以在属性值前面加上 {}
来告诉解析器:以下花括号只是花括号,没有任何特殊含义。
To elaborate: In XAML markup, {
and }
are special characters: For example, writing {Binding}
creates a Binding object. You, however, want to set the property StringFormat
to the literal value {0} {1}
. Thus, you prefix your property value with {}
to tell the parser: "The following braces are just braces and do not carry any special meaning."
这篇关于{}括号在Binding语法的StringFormat部分中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!