2

How would I set a Grid Column to be sorted at startup? I cannot seem to find a property on the RadGridView to tell it that I want Column one sorted Descending at startup. The grid just comes up with no sorting.

cjibo
  • 4,487
  • 6
  • 27
  • 34

2 Answers2

13

You can also do it declaratively:

 <tk:RadGridView ItemsSource="{Binding Path=YourDataSource}" >
   <tk:RadGridView.SortDescriptors>
        <tk:SortDescriptor Member="Email" SortDirection="Ascending" />
    </tk:RadGridView.SortDescriptors>
    <tk:RadGridView.Columns>
        <tk:GridViewDataColumn Header="Account" DataMemberBinding="{Binding Path=Email}" />
    </tk:RadGridView.Columns>
 </tk:RadGridView>
CyberMonk
  • 1,462
  • 2
  • 16
  • 21
1

You need to add a sort descriptor to the SortDescriptors collection.

For Example:

radGridView1.SortDescriptors.Add(new Telerik.WinControls.Data.SortDescriptor("Email", ListSortDirection.Ascending));

"Email" - is the column you want to sort on.

Richard
  • 874
  • 2
  • 9
  • 23