# BeginEdit Command

The `BeginEdit` command provides an entry point just before the editing begins.

## Execution Parameter

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

* `CellInfo`—Gets the cell information associated with the operation.
* `TriggerAction`—Gets the `SourceTriggerAction` value that triggered the operation.
* `Parameter`—Gets an optional parameter holding additional information associated with the operation.

## Custom BeginEdit 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 BeginEdit Command**

```C#
	public class CustomBeginEditCommand : DataGridCommand
	{
	    public CustomBeginEditCommand()
	    {
	        this.Id = CommandId.BeginEdit;
	    }

	    public override bool CanExecute(object parameter)
	    {
			// put your custom logic here
	        return true;
	    }

	    public override void Execute(object parameter)
	    {
	        var context = parameter as EditContext;
			// put your custom logic here

	        // Executes the default implementation of this command
	        this.Owner.CommandService.ExecuteDefaultCommand(CommandId.BeginEdit, context);
	    }
	}
```

#### **Add the Custom Command to the Commands Collection**

```XAML
	<Grid xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid">
		<grid:RadDataGrid Width="600" Height="460" x:Name="grid" Hold>
			<grid:RadDataGrid.Commands>
				 <local:CustomBeginEditCommand />
			</grid:RadDataGrid.Commands>
		</grid:RadDataGrid>
	</Grid>
```

## See Also

* [CancelEdit](https://www.telerik.com/winui/documentation/controls/raddatagrid/commands/editing-commands/datagrid-editingcommands-canceleditcommand)
* [CommitEdit](https://www.telerik.com/winui/documentation/controls/raddatagrid/commands/editing-commands/datagrid-editingcommands-commiteditcommand)
