New to Telerik UI for WPFStart a free 30-day trial

Insert New Row on Tab of Last Cell

Updated on Sep 24, 2025

This article will show you how to insert a new row when you are at the last column of the last row and press the Tab key.

In order to achieve the desired behavior, you should create a custom KeyboardCommandProvider and override its ProvideCommandsForKey method.

Example 1 shows how this can be done:

Example 1: Handling the Tab key

C#
	public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
	{
	    List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
	
	    // check if the tab key was hit
	    if (key == Key.Tab)
	    {
	        // get the last column index
	        var lastcolumnIndex = parentGrid.Columns.Count - 1;
	        // check if the current column is the last one
	        var isLastColumn = parentGrid.CurrentCell.Column == parentGrid.Columns[lastcolumnIndex];
	
	        // get the last row index
	        var lastRowIndex = parentGrid.Items.Count - 1;
	        // check if the current row is the last one
	        var isLastRow = parentGrid.Items.IndexOf(parentGrid.SelectedItem) == lastRowIndex;
	
	        // check if we're at the last cell
	        if (isLastColumn && isLastRow)
	        {
	            // remove all commands to execute
	            commandsToExecute.Clear();
	
	            // commit any changes if we're on the last column of the newest row
	            if (parentGrid.Items.IsAddingNew)
	            {
	                commandsToExecute.Add(RadGridViewCommands.CommitEdit);
	            }
	
	            // insert the new row and set it's focus to the first cell
	            commandsToExecute.Add(RadGridViewCommands.BeginInsert);
	            parentGrid.CurrentColumn = parentGrid.Columns[0];
	        }
	    }
	
	    return commandsToExecute;
	}

See Also

In this article
See Also
Not finding the help you need?
Contact Support