Sdílet prostřednictvím


Loading a ComboBox with "Many" Items is Slow

In the WPF ListBox and ListView, some form of virtualization takes place.  The consequence is that loading (either app or the control itself) is faster since less work is done at the get go; additionally, it can help keep working set down.  We didn't do this for ComboBox (I don't have all the background; we're discussing that right now.)  While we try to figure out if this is something we can fix for the Orcas release, there's a relatively easy fix - you can switch to using the VirtualizingStackPanel yourself.  You need to set the ItemsPanel property; see the following:

<ComboBox>

<ComboBox.ItemsPanel>
  <ItemsPanelTemplate>
    <VirtualizingStackPanel />
  </ItemsPanelTemplate>
</ComboBox.ItemsPanel>


</ComboBox>