14.18. Data Binding

Few applications do not have to work with data. Silverlight offers a rich binding model that makes it very easy to work with data. Let's create a simple example to bind data to a text box:

  1. Add a new folder called DataBinding to the example project.

  2. Right-click, and select Add New Item Silverlight UserControl. Call it DataBindingTest.

  3. In the XAML, you need to add a namespace reference to the assemblies you're going to use. Add the following line in the UserControl tag of DataBindingTest.xaml:

    xmlns:Data="clr-namespace:System.Windows.Controls; ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.