Data Binding in Silverlight 4.0

 

Data Binding in Silverlight

Data binding in Silverlight is accomplished by using the Binding class. The Binding class has two components--the source and the target--and a property that defines the way the two are bound, called the binding mode. The source is the data that is to be bound, the target is a property of the control that the data is to be bound to, and the mode defines how the data is passed between the source and the target(one-way, one-time, or two-way). You'll see how this works in the upcoming exercise.

To define the binding of a control's property, you use XAML markup extensions, such as {Binding <path>}. For example, to bind the Text property of a TextBox to a data source's FirstName, you would use the following XAML:

<TextBox Text="{Binding FirstName}" />

posted on 2011-08-15 09:51  cjerych  阅读(211)  评论(0编辑  收藏  举报

导航