GroupHeaderTap Command
The GroupHeaderTap command handles the tap gesture over a group header. The default implementation will toggle (expand or collapse) the underlying IDataGroup implementation.
Execution Parameter
The execution parameter is of type GroupHeaderContext and exposes the following properties:
-
Level—Gets the zero-based level (depth) of the group within the current dataView. -
Descriptor—Gets theGroupDescriptorBaseinstance that defines the grouping level for the group header that has been tapped. -
IDataGroup—Gets theIDataGroupimplementation that represents the data group abstraction. -
IsExpanded—Gets or sets the currentIsExpandedstate of the associated data group.
Custom GroupHeaderTap Command
The following examples show how to create a class that inherits from the DataGridCommand and add it to the Commands collection.
Create a Custom GroupHeaderTap Command
public class CustomGroupHeaderTapCommand : DataGridCommand
{
public CustomGroupHeaderTapCommand()
{
this.Id = CommandId.GroupHeaderTap;
}
public override bool CanExecute(object parameter)
{
var context = parameter as GroupHeaderContext;
// put your custom logic here
return true;
}
public override void Execute(object parameter)
{
var context = parameter as GroupHeaderContext;
// put your custom logic here
this.Owner.CommandService.ExecuteDefaultCommand(CommandId.GroupHeaderTap, context);
}
}
Add the Custom Command to the Commands Collection
<Grid xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid">
<grid:RadDataGrid Width="600" Height="460" x:Name="grid">
<grid:RadDataGrid.Commands>
<local:CustomGroupHeaderTapCommand/>
</grid:RadDataGrid.Commands>
</grid:RadDataGrid>
</Grid>