This is a migrated thread and some comments may be shown as answers.

Is there any way to make the Filtering Behavior return items in a specific order?

1 Answer 47 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 25 Jan 2019, 01:24 AM

I'm trying to modify a ComboBox to display items in the dropdown in a specific order. I would like all items that start with the search text displayed first, followed by any items that have a word that starts with the search text and finally all items that contain the search text anywhere in the string.

I was able to do this with an AutoCompleteBox by implementing a custom FilteringBehavior. I tried to do the same on the ComboBox by implementing a custom ComboBoxFilteringBehavior, but no matter what order I return the matching indices in, they always get displayed to the user in the order they appear in the ItemsSource.

Is there any way to change the order in which matched items are displayed in the dropdown?

Thank you!

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 29 Jan 2019, 03:40 PM
Hello Brian,

The filtering behavior of the combobox finds the matching indexes and hides the rest of the items from the UI just by setting their Visibility. This is why the order defined in the FindMatchingIndexes override of the behavior is not taken into account. 

In order to achieve your requirement you will also need to filter the ItemsSource of the RadComboBox control.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
Brian
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or