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}" />

Powered By D&J (URL:http://www.cnblogs.com/Areas/)
原文地址:https://www.cnblogs.com/Areas/p/2153142.html