Table of Contents

Class ObservableCollectionExtended<T>

Namespace
NMF.Collections.ObjectModel
Assembly
NMF.Collections.dll

Denotes an abstract extension of observable collections

public abstract class ObservableCollectionExtended<T> : Collection<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable, INotifyCollectionChanging, INotifyPropertyChanged, INotifyCollectionChanged

Type Parameters

T
Inheritance
ObservableCollectionExtended<T>
Implements
Derived
Inherited Members

Methods

ClearItems()

Removes all elements from the Collection<T>.

protected override void ClearItems()

InsertItem(int, T)

Inserts an element into the Collection<T> at the specified index.

protected override void InsertItem(int index, T item)

Parameters

index int

The zero-based index at which item should be inserted.

item T

The object to insert. The value can be null for reference types.

Exceptions

ArgumentOutOfRangeException
   <code class="paramref">index</code> is less than zero.  

-or-

index is greater than Count.

MoveItem(int, int)

Moves a given item

public virtual void MoveItem(int oldIndex, int newIndex)

Parameters

oldIndex int

the old index

newIndex int

the new index

OnCollectionChanged(NotifyCollectionChangedEventArgs, bool)

Gets called when the collection was changed

protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e, bool countAffected)

Parameters

e NotifyCollectionChangedEventArgs

the event args

countAffected bool

True, if the Count is also affected, otherwise False

OnCollectionChanging(NotifyCollectionChangedEventArgs)

Gets called when an attempt is made to change the collection

protected virtual void OnCollectionChanging(NotifyCollectionChangedEventArgs e)

Parameters

e NotifyCollectionChangedEventArgs

the event args

RemoveItem(int)

Removes the element at the specified index of the Collection<T>.

protected override void RemoveItem(int index)

Parameters

index int

The zero-based index of the element to remove.

Exceptions

ArgumentOutOfRangeException
   <code class="paramref">index</code> is less than zero.  

-or-

index is equal to or greater than Count.

RequireEvents()

Determines whether events are required

protected bool RequireEvents()

Returns

bool

True, if there is any subscriber to CollectionChanged, CollectionChanging or PropertyChanged events

SetItem(int, T)

Replaces the element at the specified index.

protected override void SetItem(int index, T item)

Parameters

index int

The zero-based index of the element to replace.

item T

The new value for the element at the specified index. The value can be null for reference types.

Exceptions

ArgumentOutOfRangeException
   <code class="paramref">index</code> is less than zero.  

-or-

index is greater than Count.

Events

CollectionChanged

Occurs when the collection changes.

public event NotifyCollectionChangedEventHandler CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

CollectionChanging

Gets raised when an attempt is made to change a given collection

public event EventHandler<NotifyCollectionChangedEventArgs> CollectionChanging

Event Type

EventHandler<NotifyCollectionChangedEventArgs>

PropertyChanged

Occurs when a property value changes.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler