Using Listview with SfDataPager in UWP DataPager (SfDataPager)
10 May 20211 minute to read
SfDataPager automatically wraps the collection in PagedCollectionView and exposes to the PagedSource property. You can pass the PagedSource
property to bind with any ItemsControl’s ItemsSource property. Here, the PagesSource
property is bound to the ListBox.
The following code explains how to use Source and PagedSource
property in ListBox.
<Page>
<Page.DataContext>
<local:ViewModel />
</Page.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="300"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ListBox ItemsSource="{Binding ElementName=sfDataPager, Path=PagedSource}"/>
<datapager:SfDataPager x:Name="sfDataPager"
Grid.Row="1"
PageSize="5"
NumericButtonCount="5"
Source="{Binding Orders}" />
</Grid>
</Page>
The following screenshot displays the output for ListView
bound with PagedCollection
.