A: 

Probably the best way to go about it is to use PagedCollectionViews, although I have not tested this out myself, these classes contain a property that stores the different sorting methods applied to them. I believe that you can probably grab the current sorting element from one collection, connect to the new collection, and apply the sorting to the new collection.

For a more in depth discussion on how this all works, you can follow the explanation here

Johannes
I will give this a shot and let you know if it works for what I'd like. I'll also post the code (and maybe screen shots) of what I did and how I did it. Thanks for the answer!
Scott
Scott - I am having the same problem. Did you find a resolution for this?
Lee Roth
When I look at your link to MSDN, I see PagedCollectionView explained, but I do notice that this is for Silverlight 3.0, not Silverlight 2.0. I cannot find this in Silverlight 2.0, is there an equivalent for the 2.0 side of things?
Scott
A: 

I tried using PagedCollectionViews as well as CollectionViewSources (I used the new collection to overwrite the existing source collection).

My solution isn't the most elegant, but it works. When updating the source of the DataGrid I did my own change detection.

In other words, instead of blindly overwriting the source collection I iterated through the new collection, compared each item to the existing collection, and updated the existing items where possible.

Hope that helps.

Lee Roth
This PagedCollectionView(s) class does not exist in SL 2.0, I don't think. If I'm wrong, can you point me to where this is? Thanks
Scott
Sorry, you're right, it's in SL 3.
Lee Roth
A: 

After researching how to do this, I have figured it out. I tried to implement what the others said to try, but could not get it to work in Silverlight 2.0. Thus, I searched StackOverflow and Google for more answers. ScottLogic and CodeProject seemed to be what I was looking for but I couldn't get them to work fully. So with a bit of frustration and playing around with code, I finally arrived on the solution.

If the collection that you're using for your DataGrid's ItemsSource is ObservableCollection(Of T), you can get the ability of sorting for the object, plus you can update the collection dynamically at runtime, causing the grid to refresh with the item you insert. I've created a Google Code project that is GPL for you to checkout and download. Please note that I'm using the Microsoft Silverlight 2.0 DataGrid December 2008 Release for this project. I have linked to this download on the project page as well. (The dll's required are referenced from within a lib folder inside the project).


Enjoy!


Silverlight 2.0 DataGrid Sort Project on Google Code

Scott