Represents a dynamic data collection that provides notifications when items get added, removed, or when the entire list is refreshed.
Namespace:
System.Collections.ObjectModel
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public Class ObservableCollection(Of T) _
Inherits Collection(Of T) _
Implements INotifyCollectionChanged, INotifyPropertyChanged
Dim instance As ObservableCollection(Of T)
public class ObservableCollection<T> : Collection<T>,
INotifyCollectionChanged, INotifyPropertyChanged
Type Parameters
- T
The type of elements in the collection.
You can enumerate over any collection that implements the IEnumerable interface, and this is adequate for one-time data binding in Silverlight. However, to set up dynamic bindings so that insertions or deletions in the collection can update the UI automatically, the collection must implement the INotifyCollectionChanged interface. This interface exposes the CollectionChanged event, an event that should be raised whenever the underlying collection changes.
Silverlight provides the ObservableCollection<(Of <(T>)>) class, which is a provided base class data collection that implements the INotifyCollectionChanged interface, as well as the INotifyPropertyChanged interface. It also has the expected collection support, defined by deriving from the Collection<(Of <(T>)>) class.
For an example, see Walkthrough: Binding to a Collection and Creating a Master/Details View.
System..::.Object
System.Collections.ObjectModel..::.Collection<(Of <(T>)>)
System.Collections.ObjectModel..::.ObservableCollection<(Of <(T>)>)
System.Windows.Controls..::.CalendarBlackoutDatesCollection
System.Windows.Controls..::.SelectedDatesCollection
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference