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

Change the order of Suggestions

1 Answer 63 Views
AutocompleteBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Simon
Top achievements
Rank 1
Simon asked on 11 May 2015, 12:50 PM

Hi,

I'm trying to change the order of the suggestions in an AutocompleteBox, since per default the suggestions are ordered alphabetically.

 

I've got an ObservableCollection<City> (a collection of all cities in Germany with more than 1000 inhabitants), which is ordered by "Size" and used as the SuggestionsSource of the AutocompleteBox. The user can't see the Size, but only the Name. The AutocompleteBox changes the order, however. I would like to show the suggestions sorted by Size, not by Name. For example, if the user types "Ber", the topmost suggestion should be "Berlin".

public class City
{
    public City() { }
    public City(int size, string name) { Size = size; Name = name; }
 
    public int Size { get; set; }
    public string Name { get; set; }
}

How can I change the sorting behaviour of the SuggestionsSource?

 

Thanks!
Simon

 

1 Answer, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 14 May 2015, 11:05 AM
Hello Simon,

Thank you for contacting us. Unfortunately, this scenario is not supported out of the box. I can suggest using an external control to display the suggested items. This way you will be able to use your sorting mechanism before you display the items. Unfortunately, this could decrease the performance of the control. I have attached a sample.

Please, let us know if you have any other questions.

Regards,
Rosy Topchiyska
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
AutocompleteBox
Asked by
Simon
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or