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?
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; } }
Hi,@元常 庞 . Welcome Microsoft Q&A.
Could you show me the complete sample code that reproduces your problem to analyze?
Thanks for you quick response.
please download sample project from one driver.
Start the project and click [Ctrl] + A to take about 10+ seconds to select all items.
remove the group style in xaml file, select all completed instantly.
iThe code was uploaded to github also.
Hi,@元常 庞 . I reproduced your problem. Based on my searches, I haven't found an official explanation yet. For the problem of UI virtualization and
VirtualizingPanel.IsVirtualizingWhenGroupingnot working when ListView contains
GroupStyle, It is recommended that you could ask questions in the Developer Community.
I've step into the WPF source code. it is not about UI Virtuallization, the issue is caused by method ContainerFromIndex in ItemContainerGenerator.cs.
Could you give some suggestion or may i know who can give suggestion how to fix this?
Is there an update to the question? I'm still looking, but haven't found a solution yet.
Sign in to comment