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

Extends ObservableCollection<T> by forwarding subscribed item notifications as collection-level changes.

Subscription updates are performed by collection mutation overrides and are not rolled back if a collection-changing notification cancels the base mutation; in that case, subscriptions can become inconsistent with the collection contents.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.GridView.dll

Type Parameters:

T

An item type that exposes property-changing and property-changed notifications.

Syntax:

C#
public class ItemObservableCollection<T> : ObservableCollection<T>, IList, ICollection, IEnumerable, INotifyCollectionChanged, INotifyCollectionChanging, INotifyPropertyChanged, INotifyPropertyChangingEx where T : class, INotifyPropertyChangingEx, INotifyPropertyChanged

Inheritance: objectCollection<T>ObservableCollection<T>ItemObservableCollection<T>

Derived Classes: ColumnGroupRowCollectionConditionalFormattingObjectCollection

Implements: ICollectionIEnumerableIListINotifyCollectionChangedINotifyCollectionChangingINotifyPropertyChangedINotifyPropertyChangingEx...

Inherited Members ObservableCollection<T>.CountStringObservableCollection<T>.ItemArrayStringObservableCollection<T>.InsertItem(int, T, Action<T>)ObservableCollection<T>.Move(int, int)ObservableCollection<T>.MoveItem(int, int)ObservableCollection<T>.BeginUpdate()ObservableCollection<T>.BeginItemUpdate()ObservableCollection<T>.EndItemUpdate()ObservableCollection<T>.EndItemUpdate(bool)ObservableCollection<T>.EndUpdate(bool)ObservableCollection<T>.EndUpdate()ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedEventArgs)ObservableCollection<T>.NotifyListenersCollectionChanged(NotifyCollectionChangedEventArgs)ObservableCollection<T>.CallCollectionChanged(object, NotifyCollectionChangedEventArgs)ObservableCollection<T>.OnCollectionChanging(NotifyCollectionChangingEventArgs)ObservableCollection<T>.NotifyListenersCollectionChanging(NotifyCollectionChangingEventArgs)ObservableCollection<T>.CallCollectionChanging(object, NotifyCollectionChangingEventArgs)ObservableCollection<T>.AddRange(IEnumerable<T>)ObservableCollection<T>.RemoveRange(IEnumerable<T>)ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedAction, object, int)ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedAction, object, int, int)ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedAction, object, object, int)ObservableCollection<T>.OnCollectionReset(IList)ObservableCollection<T>.OnCollectionChanging(NotifyCollectionChangedAction, object, int)ObservableCollection<T>.OnCollectionChanging(NotifyCollectionChangedAction, object, int, int)ObservableCollection<T>.OnCollectionChanging(NotifyCollectionChangedAction, object, object, int)ObservableCollection<T>.OnCollectionReseting()ObservableCollection<T>.OnNotifyPropertyChanged(string)ObservableCollection<T>.OnNotifyPropertyChanged(PropertyChangedEventArgs)ObservableCollection<T>.OnNotifyPropertyChanging(string)ObservableCollection<T>.OnNotifyPropertyChanging(PropertyChangingEventArgsEx)ObservableCollection<T>.IsUpdatedObservableCollection<T>.CollectionChangedObservableCollection<T>.CollectionChangingObservableCollection<T>.PropertyChangedObservableCollection<T>.PropertyChangingCollection<T>.Add(T)Collection<T>.Clear()Collection<T>.CopyTo(T[], int)Collection<T>.Contains(T)Collection<T>.GetEnumerator()Collection<T>.IndexOf(T)Collection<T>.Insert(int, T)Collection<T>.Remove(T)Collection<T>.RemoveAt(int)Collection<T>.CountCollection<T>.ItemsCollection<T>.this[int]...

Constructors

Initializes an empty collection.

C#
public ItemObservableCollection()

Initializes the collection from the specified list.

C#
public ItemObservableCollection(IList<T> list)
Parameters:listIList<T>

The initial items.

Items already in list are not subscribed to for item notifications by this constructor.

Methods

Unsubscribes from each current item before requesting that the base collection be cleared.

C#
protected override void ClearItems()

Overrides: ObservableCollection<T>.ClearItems()

Requests insertion through the base collection, then subscribes to the supplied item's change notifications.

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

The index at which to insert the item.

itemT

The item to insert.

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

Subscribes to the item's property notifications and, when supported, its collection notifications.

C#
protected virtual void ItemEventsSubscribe(T item)
Parameters:itemT

The item whose notifications are subscribed.

Removes the item's property subscriptions and any collection subscriptions supported by the item.

C#
protected virtual void ItemEventsUnsubscribe(T item)
Parameters:itemT

The item whose notifications are unsubscribed.

Converts a subscribed item's property change or supported collection change into a collection-level item-change notification.

C#
protected virtual void OnItemPropertyChanged(object sender, EventArgs e)
Parameters:senderobject

The item raising the notification.

eEventArgs

The item's property or collection change arguments.

Exceptions: ArgumentException

sender is not an instance of T.

Converts a subscribed item's changing notification into a cancelable collection-changing notification.

C#
protected virtual void OnItemPropertyChanging(object sender, CancelEventArgs e)
Parameters:senderobject

The item raising the notification.

eCancelEventArgs

The item's cancelable change arguments.

Exceptions: ArgumentException

sender is not an instance of T.

Unsubscribes from the indexed item before requesting its removal from the base collection.

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

The index of the item to remove.

Overrides: ObservableCollection<T>.RemoveItem(int)

Moves notification subscriptions to the replacement item before requesting the replacement from the base collection.

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

The index of the item to replace.

itemT

The replacement item.

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