WPF 分页 CollectionViewSource
我有一个 WPF ListBox,我想为其添加分页,因为它在处理一堆项目时开始变慢。我的问题是我使用分组、排序和过滤。这意味着,如果我使用 LINQ Skip() 和 Take() 方法或使用分页 ObservableCollection 之类的方法来限制数据,则分组和排序将是错误的,因为它只会应用于数据的第一页。过滤会更糟,因为它只会过滤当前显示中显示的数据,这意味着您必须位于它显示的页面上才能搜索它。
我不太热衷于重写所有逻辑的想法。我看到 Silverlight 3 正在获取 PagedCollectionView(但据我所知,.NET 4 中的 WPF 没有获取它)。有没有人以前实施过类似的事情或者对我应该如何解决这个问题有任何想法?
I have a WPF ListBox that I would like to add pagination to as it starts getting slow with a bunch of items. My problem is that I use the Grouping, Sorting, and Filtering. That means if I were to limit the data with the LINQ Skip() and Take() methods or using something like a paginated ObservableCollection the grouping and sorting would be wrong because it would only be applied to the first page of data. Filtering would be even worse because it would just filter the data displayed in the current display which would mean you would have to be on the page that it would show up on to be able to search for it.
I'm not too keen on the idea of rewriting all of that logic. I see Silverlight 3 is getting a PagedCollectionView (but as far as I can tell WPF in .NET 4 is not getting it). Has anyone implemented something like this before or have any ideas on how I should solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看我实现的一个简单的分页 ObservableCollection - 适用于 Silverlight 以及 WPF
http ://jobijoy.blogspot.com/2008/12/pagulated-observablecollection.html
Check out a simple Paginated ObservableCollection I have implemented - works for Silverlight as well as WPF
http://jobijoy.blogspot.com/2008/12/paginated-observablecollection.html