Silverlite: Why datagrid column sorting might not be working

Column sorting in my recent Silverlight 2.0 Datagrid app wasn’t a priority, but I wanted to be able to click on a column header and sort, darn it.  I added a CanUserSortColumns=”true” property to the DataGrid and CanUserSort=”true” to each DataGridTemplateColumn.  Still nothing.

It wasn’t until I added a SortMemberPath property to the DataGridTemplateColumn some days later that I could enjoy that sexy Silverlight 2.0 Datagrid column sorting. 

<data:DataGridTemplateColumn Header=”Employee” Width=”200″ CanUserSort=”True”
  
SortMemberPath=”EmployeeName”>
    <data:DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
        <TextBlock Text=”{Binding EmployeeName}” />
    </DataTemplate>
    …..

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.