How do I sort RadListBox items by 2 data source fields (int and string)?

161 Views Asked by At

How can I custom sort items of RadListBox by multiple data source fields of different types ?

I have a RadListBox that I bind to a data source (LINQ), and need to order the items by a priority (int) and then name (string).

1

There are 1 best solutions below

0
On

In LINQ you can specify multiple order by statements, it doesn't matter what types they are. The items will first be sorted by Priority and then the subset of items for each Priority will be sorted by Name:

 myData.OrderBy(d => d.Priority).ThenBy(d => d.Name);