This project is read-only.

Sort order

Sep 1, 2009 at 7:49 PM

I am binding ReadOnlyContinuousCollection<T> to a grid  T implements INotifyPropertyChanged

which is created as below

from data in _continuousCollection orderby data.id where data.qv == "1"

and as data is available/removed / updates I do add/delete on _continuousCollection.

Filtering works fine only issue is that sort order changes .

at update rows goes up / down in the grid. any feed back

looks like internnaly clinq is doing delete and insert ?

Sep 10, 2009 at 12:32 AM

Yes,

Filtering does not guarantee sort order.  The same thing applies for regular linq even though it always does return the list the same way.  The reason for this is because of performance, and some other esoteric stuff.  If you want sort order, then you need to explicitly sort the data.  I'll take a peak again if anything new strikes me on how to keep the ordering consistent.

Thanks,

Andy

Oct 5, 2009 at 2:28 PM

Hi,

I have the same problem as mrudang

If i bind a simple OrderByDescending()-Query to my ListBox everything works fine. When items are added the ListBox showes the correct sorted items.

If i extend the query with a Select() and Distinct() the sort order dont update anymore. But i still see newly added items.

If i apply the CLINQ-Query to the ItemsSource of my ListBox again the sort order is restored. Seems like i have to recall that method if something changes manually. That means if my collection is changed AND if any item in my collection fires NotifyPropertyChanged. That also means that i have to update the PropertyChanged-Handlers in my Collection...

It would be very cool if CLINQ could also refresh the sort-order automatically in filtering queries.

Lector