开发者

WPF: ComboBox Max Items?

开发者 https://www.devze.com 2022-12-24 05:45 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号