Class EnumerablePagedSource
A page-sliced, observable collection that can be consumed by any target grid control other than SfDataGrid, such as Microsoft.Maui.Controls.CollectionView. It exposes the current page of items and updates when SfDataPager navigates. This implementation does not extend PagedCollectionView to avoid conflicts with framework CollectionView binding, but provides all the same properties and methods that the DataPager requires for paging functionality.
Inherited Members
Namespace: Syncfusion.Maui.DataPager
Assembly: Syncfusion.Maui.DataPager.dll
Syntax
public class EnumerablePagedSource : INotifyCollectionChanged, INotifyPropertyChanged, IEnumerable<object?>, IEnumerable
Constructors
EnumerablePagedSource(IEnumerable, int)
Initializes a new instance of the EnumerablePagedSource class.
Declaration
public EnumerablePagedSource(IEnumerable source, int pageSize = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable | source | The underlying source sequence. |
| int | pageSize | The default page size to use for the initial page slice. |
Properties
Count
Gets the number of items in the current page.
Declaration
public int Count { get; }
Property Value
| Type |
|---|
| int |
CurrentPage
Gets the current page's items as a stable, observable collection. Bound controls such as Microsoft.Maui.Controls.CollectionView can iterate this collection directly when binding.
Declaration
public ObservableCollection<object?> CurrentPage { get; }
Property Value
| Type |
|---|
| ObservableCollection<object> |
ItemCount
Gets the number of items in the current page.
Declaration
public int ItemCount { get; }
Property Value
| Type |
|---|
| int |
MaxItemsCount
Gets or sets the maximum number of items.
Declaration
public int MaxItemsCount { get; set; }
Property Value
| Type |
|---|
| int |
PageCount
Gets the total number of pages.
Declaration
public int PageCount { get; }
Property Value
| Type |
|---|
| int |
PageIndex
Gets the zero-based index of the current page.
Declaration
public int PageIndex { get; }
Property Value
| Type |
|---|
| int |
PageSize
Gets or sets the number of items per page.
Declaration
public int PageSize { get; set; }
Property Value
| Type |
|---|
| int |
UseOnDemandPaging
Gets or sets a value indicating whether on-demand paging is used.
Declaration
public bool UseOnDemandPaging { get; set; }
Property Value
| Type |
|---|
| bool |
Methods
GetEnumerator()
Returns an enumerator that iterates through the current page.
Declaration
public IEnumerator GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator | An enumerator for the current page. |
LoadDynamicItems(int, IEnumerable)
Loads items dynamically for on-demand paging.
Declaration
public void LoadDynamicItems(int startIndex, IEnumerable items)
Parameters
| Type | Name | Description |
|---|---|---|
| int | startIndex | The zero-based start index of the items. |
| IEnumerable | items | The items to load into the current page. |
MoveToPage(int)
Moves to the specified page index.
Declaration
public bool MoveToPage(int pageIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageIndex | The zero-based page index to move to. |
Returns
| Type | Description |
|---|---|
| bool | True if the page change succeeded; otherwise, false. |
Events
CollectionChanged
Occurs when the collection changes.
Declaration
public event NotifyCollectionChangedEventHandler? CollectionChanged
Event Type
| Type |
|---|
| NotifyCollectionChangedEventHandler |
OnDemandItemsLoading
Occurs when on-demand paging requests data.
Declaration
public event EventHandler<OnDemandItemsLoadingEventArgs>? OnDemandItemsLoading
Event Type
| Type |
|---|
| EventHandler<OnDemandItemsLoadingEventArgs> |
PropertyChanged
Occurs when a property value changes.
Declaration
public event PropertyChangedEventHandler? PropertyChanged
Event Type
| Type |
|---|
| PropertyChangedEventHandler |