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

GroupHeaderTap Command

Handles the tap gesture over a group header. The default implementation will toggle (Expand/Collapse) the underlying IDataGroup implementation.

Execution Parameter

The execution parameter is of type GroupHeaderContext which 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

Examples 1 and 2 show how to create a class that inherits from DataGridCommand and add it to the Commands collection.

Example 1: Creating 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);           
    } 
} 

Example 2: Adding 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?