Reputation: 4667
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.
Upvotes: 2
Views: 5976
Reputation: 1622
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>
Upvotes: 13
Reputation: 896
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.
Upvotes: 1