Events
There are two events that are raised when the data in the RadGridView is sorted. The first one is the SortChanging event which is raised before the data is sorted. The second one is the SortChanged event and it is raised after the data is sorted.
From the event arguments of both events you can access the following data:
Action: An enumeration with values: Add, Remove, ItemChanged and Reset. The Action property notifies if a SortDescriptor is added, removed, modified or the SortDescriptors collection is cleared.
NewItems: Is a List of added, edited or removed SortDescriptors. For each SortDescriptor you can get its PropertyName and Direction.
You are also able to cancel the sorting operation by setting the Cancel property to True.
Since the SortDescriptors collection implements the INotifyPropertyChanged interface, you can use its CollectionChanged event (The arguments of this event provide the same data as the SortChanged event).
As of R1 2021 RadGridView offers two new events:
- GroupSortChanging: Fires when the user changes the sorting of the group. The action can be canceled.
- GroupSortChanged: Fires after the user has changed the sorting of the group.
The GridViewGroupSortChangingEventArgs gives you access to the GridViewTemplate, GroupDescriptor and the new ListSortDirection.