Developing on Staxmanade

Silverlight DataGrid NOT sorting when binding to IEnumerable<T>

This may be common knowledge when working with a Silverlight DataGrid, or any grid control in .net. However, I fought through this lesson the other week.

We are using Prism V2 in a business application at work. When databinding several grids to a presenter I tried to enable sorting and ran into an issue where the grid wouldn’t sort if the property being bound to was an IEnumerable<T>…

Once I changed the property’s type to a List<T> on the presentation model (and all the correct sorting xaml tags were set) the grid became sortable.

The other strange thing about this was I couldn’t find anything about it on the net… Is this something that is inherent with other data grids?


Radenko Zec
IEnumerable does not have sort method but generic List have Sort method.
I probably left a few details out of this post...

I Set the grid's allows sorting property to true and every cell was a custom data template with the SortMember path set
Justin Chase
That is weird. How are you doing the binding? Maybe it's just calling into the IList.Sort method? Seems like it should just use Enumerable.Sort though.