Search code examples
wpfrestdata-paging

Paged data in a WPF Grid control


I have a Rest service that returns the data in pages. I know how many pages of data there is after getting the first result set. Now I want to consume this service in a WPF application, e.g. display the result in a Grid Control (or a list view).

The problem is that the whole paging mechanism should be transparent to the end user, so they shouldn't trigger data fetching by any means other than scrolling in the grid. Is this possible and how would you tackle this problem?


Solution

  • Here is another possible solution of your task: http://www.devzest.com/blog/post/wpf-data-virtualization.aspx

    Main idea is to create your own implementation of IList which will encapsulate all async page loading features.

    As a bonus that article contains full example code with a set of additional features:

    • Selection, sorting and filtering works well as if all data are stored locally;
    • Data loading as needed, in a separate thread, without blocking the UI;
    • Visual feedback when data is loading; if failed, user can retry the last failed attempt.