WPF ListView SelectAll performance when group enabled

元常 庞 1 Reputation point

The listview loads about 50k rows of data, i'm sure Virtualizing is enabled, the listview loads without any issue. SelectAll operation completed really quick if group is not enabled, but the performance get very bad when grouping is enabled.

After some investigation, i found the cause of the issue is by below code
method ContainerFromIndex in ItemContainerGenerator.cs(wpf source) , is there any way to improve the performance in this scenario?

if (IsGrouping)
int n;
subIndex = index;
for (index=0, n=ItemsInternal.Count; index < n; ++index)
CollectionViewGroup group = ItemsInternal[index] as CollectionViewGroup;
int size = (group == null) ? 1 : group.ItemCount;

                if (subIndex < size)  
                    subIndex -= size;  
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,709 questions
{count} votes