This documentation is archived and is not being maintained.

How to: Improve the Scrolling Performance of a ListBox

Updated: February 2009

If a ListBox contains many items, the user interface response can be slow when a user scrolls the ListBox by using the mouse wheel or dragging the thumb of a scrollbar. You can improve the performance of the ListBox when the user scrolls by setting the VirtualizingStackPanelVirtualizationMode attached property to Recycling.


The following example creates a Listbox and sets VirtualizingStackPanelVirtualizationMode to Recycling to improve performance during scrolling.



    <src:LotsOfItems x:Key="data"/>

  <ListBox Height="150" ItemsSource="{StaticResource data}" 
             VirtualizingStackPanel.VirtualizationMode="Recycling" />


The following example shows the data that the previous example uses.

public class LotsOfItems : ObservableCollection<String>
    public LotsOfItems()
        for (int i = 0; i < 1000; ++i)
            Add("item " + i.ToString());




February 2009

Added Visual Basic example.

Customer feedback.

July 2008

Added topic to show the new UI virtualization and container recycling features.

SP1 feature change.