[ACCEPTED]-WPF ListView Very Slow Performance - Why? (ElementHost, or Other Reason?)-elementhost
Accepted answer
Use virtualization
<ListView ItemsSource="{BindingNames}"Name="lv">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<!--<StackPanel/>
If StackPanel was used, the memory consumed was over 2GB and dead slow.
-->
<VirtualizingStackPanel>
<!--Memory footprint is only 200 mb-->
</VirtualizingStackPanel>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
0
You may also want to check this excellent 3 article on the Code Project:
WPF: Data Virtualization By 2 Paul McClean http://www.codeproject.com/KB/WPF/WpfDataVirtualization.aspx
It show you a much better approach 1 at minimal memory and bandwidth usage.
I had a case where the answers presented 5 here didn't solve my problem. In my case, setting 4 the MaxHeight
property of the ListView
to a value larger 3 than the actual displayed height solved 2 it immediately, thanks to this answer here, even if I cannot 1 explain how and why it worked.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.