sakshi sharma
what is the difference between list and observable collection?
By sakshi sharma in WPF on Jun 05 2012
  • Munesh Sharma
    Apr, 2014 23

    An ObservableCollection can be updated from UI exactly like any collection. The true difference is rather straightforward:ObservableCollection implements INotifyCollectionChanged which provides notification when the collection is changed (you guessed ^^) It allows the binding engine to update the UI when the ObservableCollection is updated.However, BindingList implements IBindingList.IBindingList provides notification on collection changes, but not only that. It provides a whole bunch of functionality which can be used by the UI to provide a lot more things than only UI updates according to changes, like:Sorting Searching Add through factory (AddNew member function). Readonly list (CanEdit property) All these functionalities are not available in ObservableCollectionAnother difference is that BindingList relays item change notifications when its items implement INotifyPropertyChanged. If an item raises a PropertyChanged event, the BindingList will receive it an raises a ListChangedEvent with ListChangedType.ItemChanged and OldIndex=NewIndex (if an item was replaced, OldIndex=-1). ObservableCollection doesn't relay item notifications.Note that in Silverlight, BindingList is not available as an option: You can however use ObservableCollections and ICollectionView (and IPagedCollectionView if I remember well).

    • 2
  • sakshi sharma
    Jun, 2012 5


    An ObservableCollection can be updated from UI exactly like any collection. The true difference is rather straightforward:

    ObservableCollection implements INotifyCollectionChanged which provides notification when the collection is changed

    A list provides methods to search, sort, and manipulate lists.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS