How to change the AutoComplete sorting behavior

4 posts, 0 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Feb 2013

    Posted 07 Feb 2013 Link to this post

    Hi,

    Let's say I have a combo box with these string items which must be in the following order:

    "AZ"
    "AA"

    If I type 'A' when the combo box has focus, the text "AZ" will be selected.  I would prefer to have the auto-completion suggest matching values in alphabetical order, but there doesn't seem to be any way to do this.  Is there a way to do this out-of-the-box, and if not, is there a custom way I could accomplish this with a little more work?  I've tried handling the TextInput event but there seems to be a known bug in which that event is broken in current versions of the library.  Also, whatever solution I come up with needs to be able to work with both WPF and Silverlight versions of the control.

    Thanks,
    Mike Vargas
  2. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 13 Feb 2013 Link to this post

    Hello Mike,

    I am sorry for the late response.

    If you need to sort your collection, you could bind the ItemsSource property of the RadComboBox to collection of type ICollectionView like the CollectionView class in order to sort, group and filter this collection. Here you could find a few examples how to achieve sorting, grouping and filtering.

    I hope this helps.

    All the best,
    Ventzi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    2 posts
    Member since:
    Feb 2013

    Posted 13 Feb 2013 Link to this post

    Thank you, but I don't need to sort the collection.  In my example, I intentionally want the list to be sorted in a very specific way:

    AZ
    AA

    I don't want to change that ordering.  But, when the ComboBox has focus and I press the 'A' key on the keyboard, I want "AA" to be selected (since it comes first in alphabetical order).  Currently "AZ" would be selected, which is not what I want.

    Is there a way to change the auto-complete behavior to accomplish this?

    Thanks,
    Mike
  5. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 18 Feb 2013 Link to this post

    Hi Michael,

    Unfortunately there is no way to achieve this behavior with RadComboBox control. We would suggest you to use RadAutoCompleteBox which has FilteringBehavior property. You could write a custom FilteringBehavior which match all the requirements.

    We're sorry for the inconvenience caused.

    Kind regards,
    Ventzi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top