O'Reilly logo

Data-Driven Services with Silverlight 2 by John Papa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Modes and Notifications

Chapter 2 demonstrated the foundations of data-binding functionality in Silverlight 2 using the DataContext property and runtime binding techniques through both Visual Studio and Expression Blend. All of the examples in Chapter 2 used the default binding mode of OneWay, which tells the bindings to push values from the source to the target when the source values change. The binding modes and their related functionality are a critical piece of the data-binding component. The binding modes make it very easy to support the binding of a source to a target and a target back to a source, if appropriate. A control’s binding can indicate that it should be bound source to the target, for read-only data, or the control can designate that the binding should flow in both directions, thus making the control and its data values user-editable.

Two of the key sources of the power of XAML-based data binding are the INotifyPropertyChanged interface and the INotifyCollectionChanged interface. These interfaces provide the means for data source objects to let data bindings know that something about the source has changed. The ObservableCollection<T> implements the INotifyCollectionChanged interface, which yields a collection class that is able to provide notifications when items in the collection change.

Chapter 2 demonstrated how to bind a single-entity object source to a series of Silverlight 2 controls through various means, including inheriting a DataContext. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required