New to Telerik UI for WinUI? Download free 30-day trial

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 data View.
  • Descriptor—Gets the GroupDescriptorBase instance that defines the grouping level for the group header that has been tapped.
  • IDataGroup—Gets the IDataGroup implementation that represents the data group abstraction.
  • IsExpanded—Gets or sets the current IsExpanded state 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> 

See Also

In this article
Not finding the help you need?