Pergunta

So as the title suggests, I have about 15,000 items and I'm trying to bind them to a ComboBox. well I have a data grid and I tried using a DataGridComboBoxColumn which was slow so I switched to a DataGridTemplateColumn using DataTemplates but it's not any faster. I've been searching online for a long time and I profiled my code and the majority of the time isn't being spent in my code. So my question is how would I speed that up? I'm pretty new to WPF and C#. My collection is a static ObservableCollection that I'm binding to the ItemsSource.

Foi útil?

Solução

The default ItemsPanel of a ComboBox might be a StackPanel, which lacks virtualization, you could try to replace it with a VirtualizingStackPanel to see if that is the issue.

However this is still kind of a bad idea unless you use the ComboBox's keyboard input capabilities.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top