WPF网格控件中的分页数据 [英] Paged data in a WPF Grid control

查看:217
本文介绍了WPF网格控件中的分页数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rest服务,可以返回页面中的数据.我知道获得第一个结果集后有多少页数据.现在我想在WPF应用程序中使用此服务,例如在网格控件(或列表视图)中显示结果.

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?

推荐答案

这是您任务的另一种可能的解决方案:

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

主要思想是创建自己的 IList 实现,该实现将封装所有异步页面加载功能.

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:

  • 选择,排序和过滤效果很好,就好像所有数据都存储在本地一样;
  • 根据需要在单独的线程中加载数据,而不会阻塞UI;
  • 加载数据时的视觉反馈;如果失败,则用户可以重试上次失败的尝试.
  • 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.

这篇关于WPF网格控件中的分页数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆