ListView for WPF | ComponentOne
Work with ListView / Paging
In This Topic
    Paging
    In This Topic

    With paging, large data can be loaded in the ListView control in chunks or pages.

    Paging in Listview

    DataCollection provides C1PagedDataCollection<T> class, which supports paging in the ListView control. The C1PagedDataCollection<T> class works as a collection that wraps another collection to be shown in pages.

    The following code implements paging in the ListView control with the help of the C1DataPager control.

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <c1:C1ListView x:Name="listView"  DisplayMemberPath="Name" Grid.Row="0" SelectionMode="Single" ItemHeight="30"/>
        <c1:C1DataPager x:Name="pager" Grid.Row="1" />
    </Grid>
    
    public MainWindow()
    {
        InitializeComponent();
        //Bind to datasource    
        var persons = new C1PagedDataCollection<Person>(new VirtualModeDataCollection() { PageSize = 10 }) { PageSize = 10 };
        pager.Source = persons;
        listView.ItemsSource = persons;
    }