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

2 posts, 0 answers
  1. Brian
    Brian avatar
    19 posts
    Member since:
    Feb 2014

    Posted 24 Jan 2019 Link to this post

    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!

  2. Martin Ivanov
    Martin Ivanov avatar
    2403 posts

    Posted 29 Jan 2019 Link to this post

    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.

    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.
Back to Top