1000 combobox binding
.net, combobox, performance, wpf, xaml
Solution
`ComboBox` doesn’t use virtualization(`VirtualizingStackPanel`) by default, you can change the panel used by the control in a very simple way:
<ComboBox ItemsSource="{Binding}">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
Ref: Improving Combobox Performance through UI Virtualization
That helps a lot in improving performance in case a `ComboBox` is having thousands of items, not sure how much helpful it will be in your case as having 1000 comboboxes is a lot for UI.
You can also try to put these comboBoxes in a Virtualized panel(like `ListBox` or directly using `VirtualizedStackpanel`).
Another thing you can try is to make your `ComboBox` `ItemSource` bindings asynchronous using `IsAsync` property.
I hope you are using `ObservableCollection` as your `ItemSource`;
Problem
I have a WPF form which contains 30x30 grid where each grid cell is a `ComboBox`. ComboBox values and selected value are bound from `DataContext`. The problem is it goes very slow. I have reworked the form so that it displays textboxes instead of comboboxes (and `TextBox` is converted to `ComboBox` on mouse enter) and it work instantly now. Why are ComboBoxes so slower? Are there any ways to improve massive binding of ComboBoxes?