[ACCEPTED]-WPF ListView Very Slow Performance - Why? (ElementHost, or Other Reason?)-elementhost

Accepted answer
Score: 33

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

Score: 12

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.

Score: 4

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.

More Related questions