0

I'm looking for a simple way to add data-virtualization support to WPF ComboBox?
How can I achieve that?

I tried to plug different collections to the ItemsSource property:
- https://www.codeproject.com/Articles/34405/WPF-Data-Virtualization
- https://alphachitech.wordpress.com/2015/01/31/virtualizing-observable-collection

But seems my ComboBox is displaying nothing, am I doing something wrong?

Are they supposed to work with any controls supporting ItemsSource property?

1 Answers1

0

You should set the ItemsPanel of the property to be a VirtualizingStackPanel.

<ComboBox VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.ScrollUnit="Pixel"
          VirtualizingPanel.VirtualizationMode="Recycling">
    <ComboBox.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel/>
        </ItemsPanelTemplate>
    </ComboBox.ItemsPanel>
</ComboBox>
rmojab63
  • 3,513
  • 1
  • 15
  • 28