views:

234

answers:

2

I'm having a heck of a time trying to get a silverlight datagrid to properly sort, and do so quickly (sub 1/10 second). Here's the scenario:

-WCF callback every 1/5 of a second -Take the callback, match up to the existing record in an ObservableCollection -Update the ObservableCollection's properties -Bind the grid.

I've tried a linq query, PagedCollectionView, and observablecollection.select(), all are waaaaaaay too slow, and introduce 12+ second delays in processing. Anyone else experience this?

A: 

Use PagedCollectionView, but only set it once. Create one view at application startup and then in your WCF callback update the objects instead of creating new ones. Then call Refresh() on your CollectionView.

Stephan
I did this, but it still takes to long, well over 1/10th of a second. Can you think of anything else? For the mean time I took PagedCollectionView.Refresh and tossed it inside of its own timer with a callback. It works ok, but I'm pretty disappointed that we can't sort 50 records efficiently.
DavyMac23
Are you changing the source collection at all? If you change the source collection at all it forces the DataGrid to rebuild it's whole structure.
Stephan
Yes, I'm updating the collection with the latest data...the records are the same, just updating properties
DavyMac23
If the PagedCollectionView.Refresh() is too slow then I doubt you will be able to get it faster.
Stephan
A: 

Calling PagedCollectionView.Refresh from a separate timer works. This prevents the Refresh call from getting called every 1/10 of a second (which is the frequency of callbacks in my scenario).

DavyMac23