Table of Contents

Class BindingTrackingList<T>

Namespace
Rinku.Tracking.Binding
Assembly
Rinku.dll

Provides component model binding over a tracking list.

public class BindingTrackingList<T> : TrackingList<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IBindingList, ITypedList, ICancelAddNew, IList, ICollection, IEnumerable

Type Parameters

T
Inheritance
BindingTrackingList<T>
Implements
Inherited Members
Extension Methods

Constructors

BindingTrackingList(IEnumerable<T>, int, IEqualityComparer<T>?, ITrackingListContext<T>?)

Creates a binding tracking list with baseline items.

public BindingTrackingList(IEnumerable<T> items, int initialCapacity = 0, IEqualityComparer<T>? comparer = null, ITrackingListContext<T>? context = null)

Parameters

items IEnumerable<T>
initialCapacity int
comparer IEqualityComparer<T>
context ITrackingListContext<T>

BindingTrackingList(int, IEqualityComparer<T>?, ITrackingListContext<T>?)

Creates an empty binding tracking list.

public BindingTrackingList(int capacity = 0, IEqualityComparer<T>? comparer = null, ITrackingListContext<T>? context = null)

Parameters

capacity int
comparer IEqualityComparer<T>
context ITrackingListContext<T>

Properties

AllowEdit

Gets whether you can update items in the list.

public bool AllowEdit { get; }

Property Value

bool

true if you can update the items in the list; otherwise, false.

AllowNew

Gets whether you can add items to the list using AddNew().

public bool AllowNew { get; }

Property Value

bool

true if you can add items to the list using AddNew(); otherwise, false.

AllowRemove

Gets whether you can remove items from the list, using Remove(object) or RemoveAt(int).

public bool AllowRemove { get; }

Property Value

bool

true if you can remove items from the list; otherwise, false.

IsSorted

Gets whether the items in the list are sorted.

public bool IsSorted { get; }

Property Value

bool

true if ApplySort(PropertyDescriptor, ListSortDirection) has been called and RemoveSort() has not been called; otherwise, false.

Exceptions

NotSupportedException

SupportsSorting is false.

this[int]

Gets or sets the element at the specified index.

public override T this[int index] { get; set; }

Parameters

index int

The zero-based index of the element to get or set.

Property Value

T

The element at the specified index.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The property is set and the IList<T> is read-only.

SortDirection

Gets the direction of the sort.

public ListSortDirection SortDirection { get; }

Property Value

ListSortDirection

One of the ListSortDirection values.

Exceptions

NotSupportedException

SupportsSorting is false.

SortProperty

Gets the PropertyDescriptor that is being used for sorting.

public PropertyDescriptor? SortProperty { get; }

Property Value

PropertyDescriptor

The PropertyDescriptor that is being used for sorting.

Exceptions

NotSupportedException

SupportsSorting is false.

SupportsChangeNotification

Gets whether a ListChanged event is raised when the list changes or an item in the list changes.

public bool SupportsChangeNotification { get; }

Property Value

bool

true if a ListChanged event is raised when the list changes or when an item changes; otherwise, false.

SupportsSearching

Gets whether the list supports searching using the Find(PropertyDescriptor, object) method.

public bool SupportsSearching { get; }

Property Value

bool

true if the list supports searching using the Find(PropertyDescriptor, object) method; otherwise, false.

SupportsSorting

Gets whether the list supports sorting.

public bool SupportsSorting { get; }

Property Value

bool

true if the list supports sorting; otherwise, false.

Methods

Add(T)

Adds an item to the ICollection<T>.

public override void Add(T item)

Parameters

item T

The object to add to the ICollection<T>.

Exceptions

NotSupportedException

The ICollection<T> is read-only.

AddNew()

Creates and adds a new item.

public override T AddNew()

Returns

T

CancelNew(int)

Discards a pending new item from the collection.

public void CancelNew(int itemIndex)

Parameters

itemIndex int

The index of the item that was previously added to the collection.

Clear()

Removes all items from the ICollection<T>.

public override void Clear()

Exceptions

NotSupportedException

The ICollection<T> is read-only.

Configure(PropertyDescriptorCollection, string?)

Sets the properties and name exposed through typed list access.

public void Configure(PropertyDescriptorCollection properties, string? listName = null)

Parameters

properties PropertyDescriptorCollection
listName string

EndNew(int)

Commits a pending new item to the collection.

public void EndNew(int itemIndex)

Parameters

itemIndex int

The index of the item that was previously added to the collection.

Insert(int, T)

Inserts an item to the IList<T> at the specified index.

public override void Insert(int index, T item)

Parameters

index int

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

item T

The object to insert into the IList<T>.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The IList<T> is read-only.

OnChanged(TrackingListChange<T>)

Handles a structural change.

protected override void OnChanged(TrackingListChange<T> change)

Parameters

change TrackingListChange<T>

OnConfirmed(TrackingListConfirmationKind, int, T)

Handles a confirmed operation.

protected override void OnConfirmed(TrackingListConfirmationKind kind, int index, T item)

Parameters

kind TrackingListConfirmationKind
index int
item T

Remove(T)

Removes the first occurrence of a specific object from the ICollection<T>.

public override bool Remove(T item)

Parameters

item T

The object to remove from the ICollection<T>.

Returns

bool

true if item was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

Exceptions

NotSupportedException

The ICollection<T> is read-only.

RemoveAt(int)

Removes the IList<T> item at the specified index.

public override void RemoveAt(int index)

Parameters

index int

The zero-based index of the item to remove.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The IList<T> is read-only.

Events

AddingNew

public event AddingNewEventHandler? AddingNew

Event Type

AddingNewEventHandler

ListChanged

Occurs when the list changes or an item in the list changes.

public event ListChangedEventHandler? ListChanged

Event Type

ListChangedEventHandler