# .NET MAUI DataPager Integration with CollectionView

You can page the data of the Telerik UI for .NET MAUI CollectionView by using the [DataPager](https://www.telerik.com/maui-ui/documentation/controls/datapager/overview) control.

![Telerik UI for .NET MAUI CollectionView integrated with DataPager showing paged Information items and page navigation controls](https://www.telerik.com/maui-ui/documentation/assets/7cc336876d3d73a720edb3c026955c5a/datapager-collectionview-paging.png)

> note Currently, the DataPager does not support the CollectionView `LoadOnDemand` collection.

## DataPager Features

Here is a list of the most important features of the DataPager control:

* [Binding to `IEnumerable`](https://www.telerik.com/maui-ui/documentation/controls/datapager/data-binding)—You can bind the Pager to any collection that implements the `IEnumerable` interface.

* Setting different [Ellipsis modes](https://www.telerik.com/maui-ui/documentation/controls/datapager/ellipsis-mode)—The ellipsis appears when the count of the page numbers is greater than the count of the numeric buttons.

* Setting different [Display modes](https://www.telerik.com/maui-ui/documentation/controls/datapager/display-mode)—You can decide which of the visual elements in the DataPager will be visible.

* [Configuring the pages](https://www.telerik.com/maui-ui/documentation/controls/datapager/page-configuration) by using the following properties:
  * `PageIndex` (`int`)—Sets the current page.
  * `PageSize` (`int`)—Specifies the number of the items per page. The default value is `10`.
  * `PageSizes` (`IList<int>`)—Specifies a list with page sizes the end user can choose from. The default values in the list are `5, 10, 20, 50`.
  * `ItemsSpacing` (`double`)—Sets the spacing between the items in the pager.

* Customizing the appearance of the DataPager by styling its elements:
  * [Style the DataPager](https://www.telerik.com/maui-ui/documentation/controls/datapager/styling/datapager)
  * [NavigationView](https://www.telerik.com/maui-ui/documentation/controls/datapager/styling/navigationview)
  * [Navigation and Numeric Buttons](https://www.telerik.com/maui-ui/documentation/controls/datapager/styling/buttons)
  * [PageSizes](https://www.telerik.com/maui-ui/documentation/controls/datapager/styling/pagesizes)

## Example

Here is an example of how to use the DataPager with the CollectionView control.

1. Define the DataPager and the CollectionView in XAML:

   ```XAML
   <Grid RowDefinitions="*, Auto">
       <telerik:RadCollectionView ItemsSource="{Binding PagedSource, Source={Reference dataPager}}"
                                  DisplayMemberPath="Information" />
       <telerik:RadDataPager x:Name="dataPager"
                             Source="{Binding MyData}"
                             Grid.Row="1"
                             PageSize="20" />
       <Grid.BindingContext>
           <local:ViewModel />
       </Grid.BindingContext>
   </Grid>
   ```

2. Add the following namespace:

   ```XAML
   xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
   ```

3. Define the `ViewModel`:

   ```C#
   public class ViewModel
   {
       public ViewModel()
       {
           var data = new ObservableCollection<Data>();
           for (int i = 0; i < 200; i++)
           {
               data.Add(new Data { Id = i, Number = i * 10 / 2, Information = "Information " + i });
           }

           MyData = data;
       }

       public ObservableCollection<Data> MyData { get; set; }
   }
   ```

4. Define sample data:

   ```C#
   public class Data
   {
       public int Id { get; set; }
       public int Number { get; set; }
       public string Information { get; set; }
   }
   ```

> For the DataPager Integration with CollectionView example, go to the [SDKBrowser Demo Application](https://www.telerik.com/maui-ui/documentation/demos-and-sample-apps/sdkbrowser-app) and navigate to the **DataPager > Integration** category.
> For the DataPager Integration with Microsoft MAUI CollectionView example, go to the [SDKBrowser Demo Application](https://www.telerik.com/maui-ui/documentation/demos-and-sample-apps/sdkbrowser-app) and navigate to the **DataPager > Integration** category.

## See Also

* [Aggregating Data in the Telerik UI for .NET MAUI DataGrid](https://www.telerik.com/maui-ui/documentation/controls/datagrid/aggregates/overview)
* [Sorting .NET MAUI DataGrid Records](https://www.telerik.com/maui-ui/documentation/controls/datagrid/sorting)
* [Styling the Appearance of the DataGrid](https://www.telerik.com/maui-ui/documentation/controls/datagrid/theming-and-styles/styling)
