ObservableItemsSource<T> class Core

ListItemsSource with LIVE change tracking: give it any list that raises INotifyCollectionChanged (typically an ObservableCollection<T>) and adds/removes/resets flow into ObservableItemsSource.StructureChanged. Items implementing INotifyPropertyChanged are tracked too: a property change raises ObservableItemsSource.ItemChanged with the item's index. ObservableItemsSource.BatchUpdates brackets a bulk mutation: notifications are suppressed and ONE StructureChanged fires at the end — a 10k-row import must not re-project 10k times.

public sealed class ObservableItemsSource<T> : IObservableItemsSource, IItemsSource, IStructureShapeSource, IDisposable
Namespace
ArionUI.Core
Package
ArionUI.Core · dotnet add package ArionUI.Core --prerelease
Implements
IObservableItemsSource, IItemsSource, IStructureShapeSource, IDisposable

Constructors

ObservableItemsSource

public ObservableItemsSource(IReadOnlyList<T> list);

Wraps the list and subscribes to its change notifications when it offers any (INotifyCollectionChanged, item INotifyPropertyChanged). Dispose to unsubscribe.

Properties

Count

public int Count { get; }

Number of items in the wrapped list.

Methods

BatchUpdates

public IDisposable BatchUpdates();

Suppress notifications for a bulk mutation; disposing the token fires one ObservableItemsSource.StructureChanged (if anything changed).

Dispose

public void Dispose();

Unsubscribes from the wrapped list's notifications.

GetItem

public object? GetItem(int index);

The item at index, or null out of range.

Events

ItemChanged

public event Action<int>? ItemChanged;

One item's content changed in place (index) — the view repaints the row.

StructureChanged

public event Action? StructureChanged;

Rows appeared, vanished or moved — the view reshapes.