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

ValidateCell Command

Provides an entry point for validating the content of a cell.

Execution Parameter

The execution parameter is of type ValidateCellContext that exposes the following properties:

  • CellInfo: Gets the cell info associated with the operation.
  • Errors: Gets or sets the errors (if any) that occurred during the validation.

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

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

See Also

In this article
Not finding the help you need?