DataGrid doesn't sort data when loaded

Apr 9, 2009 at 6:13 PM
I've got a DataGrid and one of the columns has got SortDirection attribute set to Descending. When the data is loaded there is a sort indicator showing on the column header but the data is not sorted. When I click on the column header the data gets sorted just fine. I'm using ObservableCollection as a binding source. I would expect DataGrid to sort the data when loaded. Do I have to sort my data source before binding or is there something I have to set on DataGrid?
Apr 10, 2009 at 9:57 PM
Just setting SortDirection does not sort a column. You would have to add the column to SortDescriptions.
Apr 14, 2009 at 8:56 AM
Thanks for pointing me to the right direction, it's all working now.