BindingListItemsSource class Core

A live source over an IBindingList: DataView, BindingSource, BindingList<T>. Its IBindingList.ListChanged becomes the grid's change notifications: added, deleted, moved and reset rows reshape the view, a changed item repaints its row, and a change that names its property repaints only the cells of the columns that show it (IFieldChangeSource).

The list is read in place, never copied, and the source does not subscribe to the items: an IBindingList reports item changes itself, so a second subscription per row would only report every change twice.

UI thread only. Change the list on the thread that shows the grid, as a DataGridView demands too: a DataTable filled on a worker while bound changes rows under the frame being drawn. A change from another thread is traced once (Trace) so the cause of a broken picture has a name; fill a table off-screen and bind it afterwards, or marshal the change.

public class BindingListItemsSource : IFieldChangeSource, IObservableItemsSource, IItemsSource, IStructureShapeSource, IDisposable
Namespace
ArionUI.Core
Package
ArionUI.Core · dotnet add package ArionUI.Core --prerelease
Implements
IFieldChangeSource, IObservableItemsSource, IItemsSource, IStructureShapeSource, IDisposable

Constructors

BindingListItemsSource

public BindingListItemsSource(IBindingList list);

Wraps list and listens to its IBindingList.ListChanged. Dispose to stop listening.

Properties

Count

public int Count { get; }

Number of items in the list.

List

public IList List { get; }

The wrapped list.

Methods

Dispose

public void Dispose();

Stops listening to the list.

Dispose

protected virtual void Dispose(bool disposing);

Stops listening to the list; derived sources release what they own.

GetItem

public object? GetItem(int index);

The item at index, or null out of range.

Events

FieldsChanged

public event FieldsChangedHandler? FieldsChanged;

Some values of ONE item changed in place (source index): the fields (property names) that changed, all of them in one event. Raised right before the IObservableItemsSource.ItemChanged of the same change.

ItemChanged

public event Action<int>? ItemChanged;

ONE item's displayed values changed in place (source index) — a targeted repaint suffices.

StructureChanged

public event Action? StructureChanged;

Row count or order changed (add/remove/move/reset/replace) — projections must rebuild, the layout must re-solve.