or
private void ExecuteGroupCommand(Object sender, ExecutedRoutedEventArgs e) { | |
telc.RadGridView grid = sender as telc.RadGridView; | |
if (grid != null) { | |
if (grid.CurrentCell != null) { | |
teld.IFieldDescriptor fieldDescriptor = grid.CurrentCell.Column; | |
// determine if a group descriptor for the current cell already exists | |
teld.GroupDescriptor groupDescriptor = grid.GroupDescriptors.FirstOrDefault<teld.GroupDescriptor>( | |
possibleDescriptor => possibleDescriptor.Member.Equals(fieldDescriptor.UniqueName)); | |
// if no group descriptor is found then create one and add it to the group descriptor collection. | |
// if one exists then the grid is already grouped by the selected cell so there is no need to | |
// do it again. | |
if (groupDescriptor == null) { | |
groupDescriptor = new teld.GroupDescriptor(); | |
groupDescriptor.Member = fieldDescriptor.UniqueName; | |
groupDescriptor.SortDirection = System.ComponentModel.ListSortDirection.Ascending; | |
grid.GroupDescriptors.Add(groupDescriptor); | |
} | |
} | |
} | |
e.Handled = true; | |
} |