This is a migrated thread and some comments may be shown as answers.
Cancel Edit and Delete Behavior
2 Answers 52 Views
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 21 Jun 2013, 10:37 PM
I have read that after inserting a new row in edit mode, it takes two Escape presses to allow the row to be deleted.  Why does it take two presses, what is the underlying functionality that requires this, and is there a way to configure it so the user only has to press once?

Thanks in advance,
Steve

2 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 25 Jun 2013, 07:30 AM
Hello Steve,

The first pressing of Escape makes the cell go out of edit mode and the second one reverts the changes made to the underlying property. 
What you can try is to create your own custom keyboard command provided (as illustrated in this article and this blog post) and change the commands executed for Escape key to CancelRowEdit.
For example:

public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
        {
            List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
            if (key == Key.Escape)
            {
                commandsToExecute.Clear();
                commandsToExecute.Add(RadGridViewCommands.CancelRowEdit);
            }
 
            return commandsToExecute;
        }


Regards,
Maya
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Steve
Top achievements
Rank 1
answered on 25 Jun 2013, 04:39 PM
Works like a charm, Maya!
Thanks, Steve
Asked by
Steve
Top achievements
Rank 1
Answers by
Maya
Telerik team
Steve
Top achievements
Rank 1
Share this question
or