CellHolding Command
The CellHolding
command handles the hold gesture on a grid cell. The default implementation will attempt to execute the CellFlyoutAction
command for the specified cell.
Execution Parameter
The execution parameter is of type CellHoldingContext
and exposes the following properties:
-
HoldingState
—Gets theHoldingState
reported from theHolding
event. -
CellInfo
—Gets theDataGridCellInfo
instance with which the cell is associated providing access to its column and data item.
Custom CellFlyoutAction 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 CellHolding Command
public class CustomCellHoldingCommand : DataGridCommand
{
public CustomCellHoldingCommand()
{
this.Id = CommandId.CellHolding;
}
public override bool CanExecute(object parameter)
{
var context = parameter as CellHoldingContext;
// put your custom logic here
return true;
}
public override void Execute(object parameter)
{
var context = parameter as CellHoldingContext;
// put your custom logic here
this.Owner.CommandService.ExecuteDefaultCommand(CommandId.CellHolding, 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" Hold>
<grid:RadDataGrid.Commands>
<local:CustomCellHoldingCommand/>
</grid:RadDataGrid.Commands>
</grid:RadDataGrid>
</Grid>