Sdílet prostřednictvím


INotifyCollectionChanged Interface

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Notifies listeners of dynamic changes to a collection, such as when items are added and removed, or the entire collection object is reset.

Namespace:  System.Collections.Specialized
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Interface INotifyCollectionChanged
public interface INotifyCollectionChanged

The INotifyCollectionChanged type exposes the following members.

Events

  Name Description
Public eventSupported by Silverlight for Windows Phone CollectionChanged Occurs when the items list of the collection has changed, or the collection is reset.

Top

Remarks

INotifyCollectionChanged defines one member, CollectionChanged. The event data of this event (NotifyCollectionChangedEventArgs) reports information about the nature of the collection change.

To provide change notifications for bindings to ItemsControl and its subclasses, your collection must implement this interface. Before implementing your own collection class, consider using the ObservableCollection<T> class that implements INotifyCollectionChanged and INotifyPropertyChanged.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.