Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 344
Rushino Avatar asked Nov 02 '11 13:11

Rushino


People also ask

Which of the following is the syntax of binding a command to an object?

Binding path syntax. Use the Path property to specify the source value you want to bind to: In the simplest case, the Path property value is the name of the property of the source object to use for the binding, such as Path=PropertyName . Subproperties of a property can be specified by a similar syntax as in C#.

What does binding mean XAML?

Data binding is a mechanism in XAML applications that provides a simple and easy way for Windows Runtime Apps using partial classes to display and interact with data.

What is data binding in WPF?

Data binding in Windows Presentation Foundation (WPF) provides a simple and consistent way for apps to present and interact with data. Elements can be bound to data from different kinds of data sources in the form of . NET objects and XML.

What is binding source in WPF?

A binding source is usually a property on an object so you need to provide both the data source object and the data source property in your binding XAML. In the above example the ElementName attribute signifies that you want data from another element on the page and the Path signifies the appropriate property.


1 Answers

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

like image 71
Heinzi Avatar answered Sep 28 '22 23:09

Heinzi