Rushino
Rushino

Reputation: 9495

What do the {} brackets mean in the StringFormat section of a Binding syntax?

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..

Thanks.

Upvotes: 22

Views: 3158

Answers (1)

Heinzi
Heinzi

Reputation: 172380

It's the markup extension {} escape sequence:

The escape sequence ({}) is used so that an open brace ({) can be used as a literal character in XAML.

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."

Upvotes: 30

Related Questions