質問

I'm trying to get a combobox in winform that has around 5'000 entries. I've run into a problem before - addrange hangs with this many entries. I created a seperate control to do this for myself without lagging, but I'm adding this functionality to existing comboboxes.

I was looking up VirtualizingStackPanel for WPF when trying to see if I could get around this.

Is there a way to improve the performance of addrange for a couple of thousand string entries?

役に立ちましたか?

解決

Have you tried using ComboBox.BeginUpdate and ComboxBox.EndUpdate? Using those methods improves performance when adding items.

Of course, if you have 5000 items then maybe using a ComboBox isn't the right control (having more than 200 items or so makes scrolling impossible, which defeats the point of having a drop-down selector). Have you considered using a normal textbox but with an autocomplete provider instead?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top