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
-
Collection<T>ObservableCollectionExtended<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- 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
intThe zero-based index at which
item
should be inserted.item
TThe 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
OnCollectionChanged(NotifyCollectionChangedEventArgs, bool)
Gets called when the collection was changed
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e, bool countAffected)
Parameters
e
NotifyCollectionChangedEventArgsthe event args
countAffected
boolTrue, 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
NotifyCollectionChangedEventArgsthe event args
RemoveItem(int)
Removes the element at the specified index of the Collection<T>.
protected override void RemoveItem(int index)
Parameters
index
intThe 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
intThe zero-based index of the element to replace.
item
TThe 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
CollectionChanging
Gets raised when an attempt is made to change a given collection
public event EventHandler<NotifyCollectionChangedEventArgs> CollectionChanging
Event Type
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler PropertyChanged