3

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.

Community
  • 1
  • 1
Bubbles
  • 261
  • 1
  • 2
  • 8
  • From your problem statement. "GroupStyle overrides the default VirtualStackPanel with StackPanel." Does not matter if you declared a VirtualStackPanel. – paparazzo Mar 09 '12 at 19:30
  • So no workaround using Grouping? Seems like a useless feature if it's not going to perform at the rate of a ListView with no Grouping. – Bubbles Mar 09 '12 at 20:26
  • Complain to Microsoft not SO. – paparazzo Mar 09 '12 at 21:49
  • Was your comment addressing my question or my statement? There is no workaround to allow grouping with a virtual container? – Bubbles Mar 16 '12 at 16:52
  • Have you found a solution for this my friend? Have the exact same problem here. I wish you included some code here then we could see what's your approach. Are you adding grouping from XAML or from the code? – Mehrad Jan 16 '15 at 00:13

1 Answers1

4

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.

Grouping and Virtualization

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.

Mehrad
  • 4,093
  • 4
  • 43
  • 61