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

CellTap Command

Handles the tap gesture over a grid cell. The default implementation will attempt to change the current selection, based on the SelectionMode and SelectionUnit values.

Execution Parameter

The execution parameter is of type DataGridCellInfo which exposes the following properties:

  • Column: Gets the DataGridColumn instance this cell is associated with.
  • Item: Gets the underlying data row (ViewModel instance) this cell is associated with.

Custom CellTap 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 CellTap Command

public class CustomCellTapCommand : DataGridCommand 
{ 
    public CustomCellTapCommand() 
    { 
        this.Id = CommandId.CellTap; 
    } 
 
    public override bool CanExecute(object parameter) 
    { 
        var context = parameter as DataGridCellInfo; 
        // put your custom logic here 
        return true; 
    } 
 
    public override void Execute(object parameter) 
    { 
        var context = parameter as DataGridCellInfo; 
        // put your custom logic here   
 
        this.Owner.CommandService.ExecuteDefaultCommand(CommandId.CellTap, 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" Hold> 
        <grid:RadDataGrid.Commands> 
             <local:CustomCellTapCommand/> 
        </grid:RadDataGrid.Commands> 
    </grid:RadDataGrid> 
</Grid> 

See Also

In this article
Not finding the help you need?