Table of Contents

Class VirtualScrollNotifyCollectionChangedAdapter

Namespace
Nalu
Assembly
Nalu.Maui.VirtualScroll.dll

An adapter that wraps a list implementing INotifyCollectionChanged for use with VirtualScroll.

public class VirtualScrollNotifyCollectionChangedAdapter : IVirtualScrollAdapter
Inheritance
VirtualScrollNotifyCollectionChangedAdapter
Implements
Derived
Inherited Members

Remarks

This non-generic adapter is fully AOT-compatible and is used by VirtualScroll to automatically wrap INotifyCollectionChanged collections assigned to ItemsSource.

Constructors

VirtualScrollNotifyCollectionChangedAdapter(IList)

Initializes a new instance of the VirtualScrollNotifyCollectionChangedAdapter class based on the specified observable collection.

public VirtualScrollNotifyCollectionChangedAdapter(IList collection)

Parameters

collection IList

A list which also implements INotifyCollectionChanged.

Exceptions

ArgumentNullException

Thrown when collection is null.

ArgumentException

Thrown when collection does not implement INotifyCollectionChanged.

Properties

Collection

The underlying observable collection.

protected IList Collection { get; }

Property Value

IList

Methods

GetItem(int, int)

Gets the item object for the specified section and item index.

public object? GetItem(int sectionIndex, int itemIndex)

Parameters

sectionIndex int
itemIndex int

Returns

object

GetItemCount(int)

Gets the item count for the specified section.

public int GetItemCount(int sectionIndex)

Parameters

sectionIndex int

Returns

int

GetSection(int)

Gets the section object for the specified section index.

public object? GetSection(int sectionIndex)

Parameters

sectionIndex int

Returns

object

GetSectionCount()

Gets the section count.

public int GetSectionCount()

Returns

int

ShouldIgnoreCollectionChanges()

Tells if the adapter should ignore collection changes, therefore not notifying subscribers.

protected virtual bool ShouldIgnoreCollectionChanges()

Returns

bool

Subscribe(Action<VirtualScrollChangeSet>)

Subscribes to change notifications.

public IDisposable Subscribe(Action<VirtualScrollChangeSet> changeCallback)

Parameters

changeCallback Action<VirtualScrollChangeSet>

The callback to invoke when changes occur.

Returns

IDisposable

A disposable that unsubscribes from change notifications when disposed.