New to Telerik UI for WinForms? Start a free 30-day trial

Observes property changes on its items and exposes item-level notifications in addition to collection changes.

Definition

Constructors

Initializes an empty collection that observes items added to it.

C#
public NotifiableCollection()

Initializes the collection with the specified items and observes their property changes.

C#
public NotifiableCollection(IEnumerable<T> items)
Parameters:itemsIEnumerable<T>

The items to add; must not be null.

Exceptions: ArgumentNullException

items is null.

Methods

Detaches item-property handlers before clearing the collection.

C#
protected override void ClearItems()

Overrides: ObservableCollection<T>.ClearItems()

Call the base implementation to preserve handler cleanup and the observable collection's clear notification.

Inserts an item, raises ItemAdded, and observes the item's property changes.

C#
protected override void InsertItem(int index, T item)
Parameters:indexint

The zero-based insertion index.

itemT

The item to insert.

Overrides: ObservableCollection<T>.InsertItem(int, T)

Call the base implementation to preserve item-change subscription and notification behavior.

Detaches the removed item's property-change handler before removing it.

C#
protected override void RemoveItem(int index)
Parameters:indexint

The zero-based index of the item to remove.

Overrides: ObservableCollection<T>.RemoveItem(int)

Call the base implementation to preserve handler cleanup and the observable collection's remove notification.

Replaces an item, raises ItemAdded for its index, and observes the replacement's property changes.

C#
protected override void SetItem(int index, T item)
Parameters:indexint

The zero-based index of the item to replace.

itemT

The replacement item.

Overrides: ObservableCollection<T>.SetItem(int, T)

Call the base implementation to preserve item-change subscription and notification behavior.

Events

Occurs after an item is inserted or replaces an existing item.

C#
public event EventHandler<NotifyCollectionItemAddedEventArgs> ItemAdded

Occurs when an item raises PropertyChanged; the collection also raises a reset notification.

C#
public event EventHandler<NotifyCollectionChangeEventArgs> ItemChanged