Table of Contents

Class BaseObservableCollection<T>

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Implementation of a dynamic data collection based on generic collection implementing INotifyCollectionChanged to notify listeners when items get added, removed or the whole list is refreshed.

[Serializable]
public class BaseObservableCollection<T> : Collection<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged

Type Parameters

T
Inheritance
BaseObservableCollection<T>
Implements
Derived

Constructors

BaseObservableCollection()

Initializes a new instance of collection that is empty and has default initial capacity.

BaseObservableCollection(List<T>)

Initializes a new instance of the collection as a wrapper for the specified list.

Properties

List

Gets access to the internal list.

Methods

BlockReentrancy()

Disallow reentrant attempts to change this collection. E.g. an event handler of the CollectionChanged event is not allowed to make changes to this collection.

CheckReentrancy()

Check and assert for reentrant attempts to change this collection.

ClearItems()

Called by base class when the list is being cleared; raises a CollectionChanged event to any listeners.

InsertItem(int, T)

Called by base class when an item is added to list; raises a CollectionChanged event to any listeners.

Move(int, int)

Moves item from oldIndex to newIndex within the list. Raises a CollectionChanged event to any listeners.

OnCollectionChanged(NotifyCollectionChangedAction, object?, int)

Helper to raise CollectionChanged event to any listeners.

OnCollectionChanged(NotifyCollectionChangedAction, object?, int, int)

Helper to raise CollectionChanged event to any listeners.

OnCollectionChanged(NotifyCollectionChangedAction, object?, object?, int)

Helper to raise CollectionChanged event to any listeners.

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Raise CollectionChanged event to any listeners. Properties/methods modifying this collection will raise a collection changed event through this virtual method.

OnCollectionReset()

Helper to raise CollectionChanged event with action == Reset to any listeners.

OnCountPropertyChanged()

Helper to raise a PropertyChanged event for the Count property.

OnIndexerPropertyChanged()

Helper to raise a PropertyChanged event for the Indexer property.

OnPropertyChanged(PropertyChangedEventArgs)

Raises a PropertyChanged event (per INotifyPropertyChanged).

RemoveItem(int)

Called by base class when an item is removed from list; raises a CollectionChanged event to any listeners.

SetItem(int, T)

Called by base class when an item is set in list; raises a CollectionChanged event to any listeners.

Sort()

Sorts the elements in this collection. Uses the default comparer.

Sort(IComparer<T>)

Sorts the elements in this collection. Uses the provided comparer.

Sort(Comparison<T>)

Sorts the elements in the entire collection using the specified comparison.

Sort(int, int, IComparer<T>?)

Sorts the elements in a section of this collection. The sort compares the elements to each other using the given IComparer interface. If comparer is null, the elements are compared to each other using the IComparable interface, which in that case must be implemented by all elements of the list.

Events

CollectionChanged

Occurs when the collection changes, either by adding or removing an item.

PropertyChanged

PropertyChanged event (per INotifyPropertyChanged).