dotnetmonitor.com

 
Index
Previous
Next

 

Sample: BindingList with INotifyPropertyChanged Change Notification (VS 2005) (VS Project: BindingListNotification (INPC))

Sample: BindingList without INotifyPropertyChanged Change Notification (VS 2005) (VS Project: BindingListNotification (no INPC))

Sample: ListChangeNotification

When the data source is a list (complex or simple bound list), the data source needs to provide both list and property change notification via the IBindingList interface. List change notification is used to notify user interface elements when an item has been added, removed or deleted from the list. Property change notification on a list is used to notify user interface elements that a property on an item in the list has changed (e.g. the Name property on Customer instance in the nth position of the list changed). One key aspect of list binding in Windows Forms is that IBindingList provides both list based change notification and property based change notification. In other words, and this is a key point, Windows Forms controls that are bound to a list will not listen to property change notification provided by items within the list rather Windows Forms requires the list to provide this notification on behalf of the contained items.

Prior to VS 2005, implementing IBindingList required a tight coupling between the list and contained list items as the contained items needed to tell the list when properties on them changed. In VS 2005, this has been simplified with the introduction of BindingList<T> and the INotifyPropertyChanged interface. BindingList<T> is a generic implementation of the IBindingList interface that will automatically translate child INotifyPropertyChanged events into IBindingList.ListChanged events.

Note that the experience of binding to a list based data source that is not an IBindingList may be improved if the list is bound through a BindingSource. See the BindingSource topic below for more information on BindingSource

Simple Binding
Complex Binding
Using Simple Binding with a List
Sample: Simple Binding to a List (VS 2005) (VS Project: DataBinding Intro)
Type Conversion
Formatting