WPF ListView SelectAll performance when group enabled
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)
break;
else
subIndex -= size;
}
}