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

How to change the AutoComplete sorting behavior

3 Answers 249 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 08 Feb 2013, 01:01 AM
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

3 Answers, 1 is accepted

Sort by
0
Ventzi
Telerik team
answered on 13 Feb 2013, 03:41 PM
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.

0
Michael
Top achievements
Rank 1
answered on 13 Feb 2013, 06:25 PM
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
0
Ventzi
Telerik team
answered on 18 Feb 2013, 09:06 AM
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.

Tags
ComboBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Ventzi
Telerik team
Michael
Top achievements
Rank 1
Share this question
or