DataGrid column sort not working with linq itemsource

Feb 17, 2009 at 2:48 AM
I am populating a datagrid with data from linq.  This works great, except clicking on the column header does not sort the column.  The column header shows the sort direction arrow, but the contents are not sorted.  How can I get the sort function to work?  Here is the code I am using to load the datagrid.



Sub LoadGrid()



Dim lang = From p In db.LanguageText Order By p.SpanishText Select p.SpanishText, p.EnglishText


spanishGrid.ItemsSource = lang

spanishGrid.Columns(0).Header =



spanishGrid.Columns(0).MinWidth = 100

spanishGrid.Columns(1).Header =



spanishGrid.Columns(1).MinWidth = 100


End Sub


Feb 17, 2009 at 7:09 PM
Hi John_s,

This is a known issue.  Please see this page for more information:

Feb 17, 2009 at 7:25 PM

Thanks Samantha.  I am not using linq to SQL, I am using linq to an entity.

shared db As New spanishEntities

spanishEntities is my EntityContainer.  Based on the known issues page you referred me to, shouldn't this work?


Feb 19, 2009 at 6:40 PM
Hi John,

I believe that LINQ to Entity has the same problem.  Any data source which returns an IBindingList will break our built-in sort.

Feb 22, 2009 at 8:03 PM
Edited Feb 22, 2009 at 8:04 PM

I have the same problem.

Will it be fixed soon?

Best regards