Sorting does not work with bunisess objects

Nov 28, 2008 at 4:55 PM
I have a business object that I am attaching to a grid. However, I can not sort it. It is using BindingList. Can we we make the grid sort?

Dec 1, 2008 at 8:33 AM

BindingList does not implementing sorting (or filtering), you can confirm this by testing the BindingList.SupportsSorting methods which returns false. When using a BindingList it is up to you to implement sorting.

BindingList is the old collection that is used for databinding. Within WPF you should use ObservableCollection which does implement sorting and will allow your grid to sort.

Colin E.
-- - my WPF blog - WPF DataGrid Practical Examples
Dec 1, 2008 at 8:44 PM
how can I implement sorting for IBindingList for the toolkit?

Dec 2, 2008 at 7:54 AM

You could inherit from BindingList and implement sort. See this forum post:

However, if you go to all this effort - why not just use ObservableCollection ?

Colin E.
-- - my WPF blog - WPF DataGrid Practical Examples
Dec 2, 2008 at 9:56 PM
How can I attach the sort view utility to ObjectDataProvider?

Are you going to support sorting for BindingList when you release the product?

Dec 3, 2008 at 5:27 AM
Hi Colin,

 What georgio is trying to say (I think) and what I keep trying to find, is that ObservableCollection just can't do for us, because we are usign linq objects that have a AsBingingList() method and no AsObservableCollection method.


  Unfortunately for us there is little hope sorting will ever be supported on BindingList, you can take a look at maybe it will help.

Dec 3, 2008 at 2:43 PM
We are using a framework that binding is based on BindingList. I have tried out some vendor products (telerik)
and sorting works out of the box without any extra code. They must do something internally. Can you do something similar?

Dec 11, 2008 at 9:49 AM
There's a good article here about how to get a CollectionViewSource to do the sorting on your Binding list here:
Dec 12, 2008 at 6:48 PM
I do not seem to get it to work. I do not get any error but the grid does not display the results. Any ideas? This is what I have.


<local:ExtendedCollectionViewSource x:Key="cvs" Source="{Binding}">






<ComponentModel:SortDescription Direction="Descending"/>









<dataGridView:DataGrid Grid.Row="1" Margin="6,39,31,9"












ItemsSource="{Binding Source={StaticResource cvs}}"



orders = Pts.OrderQuery.Library.



dataGridOrders.DataContext = orders;