问题描述
推荐答案
如果在WPF DataGrid中执行分组操作,则虚拟化将无法进行. DG不知道如何将树上不存在的项目分组.将DataGrid分组后,所有原始DataGridRows都将显示在可视树上,而所有 测量和安排操作将花费大量时间.根据我的了解,在分组后启用虚拟化并非直截了当.但是,您可能需要尝试一种解决方法.您可以将Items的可见性绑定到其IsExpanded 财产.这样做折叠的项目不会显示在视觉树上.供您参考,有一个第三方控件Xceed DataGrid甚至在对数据进行分组时也支持UI虚拟化: http://xceed.com/Grid_WPF_Features.html
The virtualization would not work if you perform Grouping operations in WPF DataGrid. DG has no idea to group items which do not exist on the trees. Once you group the DataGrid, the all original DataGridRows are represented on the visual tree, and all the Measure and Arrange operations will take considerable time. Based on my knowledge it's not straight-forward to enable Virtualization after grouping. But there is one workaround you may want to have a try. You could bind the visibility of Items to its IsExpanded property. By doing so items which are collapsed are not shown on the visual tree. For your reference there is one third-party control Xceed DataGrid which supports UI virtualization even when grouping data:http://xceed.com/Grid_WPF_Features.html
希望此信息对您有所帮助!如果您仍有任何疑问,请随时告诉我.
Hope this information is helpful for you! If you still have any concerns please feel free to let me know.
最诚挚的问候
这篇关于数据网格分组性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!