Whenever a collection view shall hold too many items, you can enable paging in order to reduce loading time and network consumption. For this purpose, please follow the following steps:
- In the constructor of the collection view, before the call to InitializeComponent, set the IsPagingEnabled property to true.
- Add a DataPager control (KeepItSoft.Fwk.WPF.Controls) to the collection view and bind its PagerContext property to the Pager property of the collection view (Figure 1).
In order to make this feature work, the Count delegate is required so don’t forget to pass it when you call the Initialize method of the base class.
Please be aware that the above steps only allow you to enable paging with sort and filter expressions that are declared by code. By default the datagrid only applies filters on data that it holds in its context. I’ll explain in another post how to allow dynamic sort and filter expressions with paging.