DataGrid 虚拟化通过 GroupDescriptions 绑定到 ListCollectionView
正如标题所示,我有一个绑定到 ListViewCollection 的 WPF DataGrid。数据集很大,但由于行的虚拟化,加载速度非常快。
然而,一旦我添加了一个分组,它就开始加载每一行(我可以从 wpf 调试消息中看到),让我无所事事并吃掉所有的内存。
这里提到了这一点: http://marlongrech.wordpress.com/2008/11 /22/icollectionview-explained/
具体来说,“分组将默认禁用虚拟化支持。因此,对大型数据集进行分组可能非常昂贵,请三思”在这样做之前......”
这解释了很多,但是有人知道如何覆盖该句子中的“默认”位吗?我应该完全使用其他东西吗?
As the title says, I have a WPF DataGrid bound to a ListViewCollection. The dataset is large, but the thing loads very quickly - thanks to virtualization of the rows.
However, as soon as I add a grouping, the thing starts loading every row (I can see from the wpf debug messages), leaving me twiddling my thumbs and eating all the ram.
This is mentioned here: http://marlongrech.wordpress.com/2008/11/22/icollectionview-explained/
Specifically the bit that says "Grouping will disable the Virtualization support by default. So grouping for large data sets could be really expensive, think it twice before doing it…"
Which explains a lot, but does anyone know how to override the "by default" bit in that sentence? Should I be using something else altogether?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
框架 4.0 可能没有方便的解决方案,请参阅WPF DataGrid Virtualization with Grouping。
您可以展平列表并创建自己的分组(他们在开玩笑吗?) 分组和虚拟化 http://code.msdn.microsoft.com/windowsdesktop/Grouping-and-Virtualization-56e7d3fe
似乎有框架4.5中的解决方案参见:
There is probably no convenient solution with framework 4.0 See WPF DataGrid Virtualization with Grouping.
You can flatten the list and create your own grouping (are they kidding?) Grouping and Virtualization http://code.msdn.microsoft.com/windowsdesktop/Grouping-and-Virtualization-56e7d3fe
It seems that there is a solution in framework 4.5 see: