0

I have this combobox which is bound to a list of customers with around 5k entries

 <ComboBox  ItemsSource="{Binding Customers}"  Margin="0 0 0 18" 
                       DisplayMemberPath="DisplayMember"
                       SelectedValuePath="Id"
                       SelectedValue="{Binding CustomerId,Mode=OneWay}"
                                 >
                <ComboBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel />
                    </ItemsPanelTemplate>
                </ComboBox.ItemsPanel>
  </ComboBox>

I changed to virtualization and this helped in getting the list faster but when I added SelectedValue to bind to my viewmodel it got very very slow to load.

Is there any way to overcome this problem ?

Regards

Pavel the coder
  • 565
  • 4
  • 18
  • You should be using a design that allows the user to search or filter those 5000 down to a more sensible number. Don't use a combobox as a search method and don't make a user scroll more than 2 pages of data. – Andy Mar 01 '19 at 08:55
  • Yes you are right. I switched to AutoCompleteText and it did it perfectly, thanks for your comment – user3092984 Mar 01 '19 at 10:33

1 Answers1

1

5000 entries in a combobox is quite a burden on the system.

It is also a burden on a user. In general a combobox should not contain more than 10 (debatable) items.

In general I would make the user (or the system) do a pre-selection by adding a filter which decides what items should show in the combobox E.g., all names starting with "A" or, if that set is still too large, all names starting with "Ande".

Emond
  • 50,210
  • 11
  • 84
  • 115