WPF: ComboBox Max Items?
What开发者_开发问答 is the maximum number of items you can put in a WPF ComboBox before it starts suffering serious performance degration? (Assume bare-bones XP business-class computer.)
What is the maximum number of items you can put in a WPF ComboBox before a typical user will start complaining?
Well, if you utilize virtualization on your ComboBox
items, then this number will essentially become infinite (because you will only ever render the items that need to be rendered). Virtualization is built into other WPF controls, such as the ListBox
, but is not included inherently on the ComboBox
. You can add it quite easily, though, using the following mark-up:
<ComboBox ItemsSource="{Binding}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
Without any virtualization, I imagine this number varies from machine to machine, and depends on how the items are rendered. If they are simple text items (with no other embedded controls), this number will probably be in the low thousands. Experimentation is, as always, the preferred tactic.
精彩评论