Class VirtualScrollGroupedNotifyCollectionChangedAdapter<TSectionCollection, TItemCollection>
- Namespace
- Nalu
- Assembly
- Nalu.Maui.VirtualScroll.dll
An adapter that wraps a grouped observable collection for use with VirtualScroll.
public class VirtualScrollGroupedNotifyCollectionChangedAdapter<TSectionCollection, TItemCollection> : IVirtualScrollAdapter where TSectionCollection : IList, INotifyCollectionChanged where TItemCollection : IList, INotifyCollectionChanged
Type Parameters
TSectionCollectionThe type of the sections' collection.
TItemCollectionThe type of the items collection within each section.
- Inheritance
-
VirtualScrollGroupedNotifyCollectionChangedAdapter<TSectionCollection, TItemCollection>
- Implements
- Derived
- Inherited Members
Constructors
VirtualScrollGroupedNotifyCollectionChangedAdapter(TSectionCollection, Func<object, TItemCollection>)
Initializes a new instance of the VirtualScrollGroupedNotifyCollectionChangedAdapter<TSectionCollection, TItemCollection> class.
public VirtualScrollGroupedNotifyCollectionChangedAdapter(TSectionCollection sections, Func<object, TItemCollection> sectionItemsGetter)
Parameters
sectionsTSectionCollectionThe collection of sections.
sectionItemsGetterFunc<object, TItemCollection>A function that extracts the items collection from a section object.
Properties
Sections
The underlying observable collection.
protected TSectionCollection Sections { get; }
Property Value
- TSectionCollection
Methods
GetItem(int, int)
Gets the item object for the specified section and item index.
public object? GetItem(int sectionIndex, int itemIndex)
Parameters
Returns
GetItemCount(int)
Gets the item count for the specified section.
public int GetItemCount(int sectionIndex)
Parameters
sectionIndexint
Returns
GetSection(int)
Gets the section object for the specified section index.
public object? GetSection(int sectionIndex)
Parameters
sectionIndexint
Returns
GetSectionCount()
Gets the section count.
public int GetSectionCount()
Returns
GetSectionItems(int)
Gets the items collection for the specified section.
protected TItemCollection GetSectionItems(int sectionIndex)
Parameters
sectionIndexint
Returns
- TItemCollection
ShouldIgnoreCollectionChanges()
Tells if the adapter should ignore collection changes, therefore not notifying subscribers.
protected virtual bool ShouldIgnoreCollectionChanges()
Returns
Subscribe(Action<VirtualScrollChangeSet>)
Subscribes to change notifications.
public IDisposable Subscribe(Action<VirtualScrollChangeSet> changeCallback)
Parameters
changeCallbackAction<VirtualScrollChangeSet>The callback to invoke when changes occur.
Returns
- IDisposable
A disposable that unsubscribes from change notifications when disposed.