Reputation: 261
From my understanding, the default ItemsPanel for ListView is VirtualizingStackPanel. When I create a GroupStyle for my list view, the refresh rate is terrible. Based on comments in this post
WPF ListView Very Slow Performance - Why? (ElementHost, or Other Reason?)
GroupStyle overrides the default VirtualStackPanel with StackPanel. I have explicitly declared a VirutalzingStackPanel as my ListView's ItemsPanel, but performance is still bad. Why is grouping so slow? More than likely there is something going on with grouping I don't understand.
Upvotes: 3
Views: 2306
Reputation: 4203
As the author of the post below mentions
In a normal WPF ItemsControl that virtualizes, such as ListBox or ListView, virtualization turns off when you turn grouping on. This sample shows how to achieve the same visual look of grouping and much of the same API while still having virtualization.
Have a look at this solution developed in the sample project. However, not an easy or straight forward method at all.
Remember that this method is suggested for .NET 4.0 and earlier. I believe there are new methods introduced in the .NET 4.5 which deal with this situation such as VirtualizingPanel.IsVirtualizingWhenGrouping
property. However I haven't tested this since I don't have an access to .NET 4.5 atm.
VirtualizingPanel.IsVirtualizingWhenGrouping Attached Property
Gets or sets a value that indicates whether this VirtualizingPanel virtualizes the items in its collection when it displays groups.
Upvotes: 4