I have setup in my code a RoutedCommand for escape key:
public static RoutedCommand CloseFormCommand = new RoutedCommand();
CloseFormCommand.InputGestures.Add(new KeyGesture(Key.Escape));
This works fine when the keyboard focus is on a control like a textbox in the form. But as soon as I click on the Grid and it is set to Edit mode pressing the Escape key will just finish the edit mode and it won't call the command unless I set the cursor back to the textbox by mouse and press the Escape key. How can I fix this problem?
public static RoutedCommand CloseFormCommand = new RoutedCommand();
CloseFormCommand.InputGestures.Add(new KeyGesture(Key.Escape));
This works fine when the keyboard focus is on a control like a textbox in the form. But as soon as I click on the Grid and it is set to Edit mode pressing the Escape key will just finish the edit mode and it won't call the command unless I set the cursor back to the textbox by mouse and press the Escape key. How can I fix this problem?
7 Answers, 1 is accepted
0
Hello Ramin,
Nedyalko Nikolov
the Telerik team
You can override keyboard behavior like demonstrated in this blog post.
Let me know if this doesn't help.
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Ramin
Top achievements
Rank 1
answered on 19 Oct 2010, 04:54 PM
Hi Nedyalko,
Thanks for the response. I've looked at the blog you sent. I don't have any problem with the function of Escape key in the Grid. Escape is canceling the edit and I need it. My problem is that after pressing escape and canceling from edit mode I need to press escape again and this time the escape should activate my RoutedCommand and this is not happening unless I change the focus from Grid to another control.
Thanks for looking into this,
Thanks for the response. I've looked at the blog you sent. I don't have any problem with the function of Escape key in the Grid. Escape is canceling the edit and I need it. My problem is that after pressing escape and canceling from edit mode I need to press escape again and this time the escape should activate my RoutedCommand and this is not happening unless I change the focus from Grid to another control.
Thanks for looking into this,
0
Hello Ramin,
Best wishes,
Nedyalko Nikolov
the Telerik team
Could you please try to register your custom command with RadGridView and let me know about the result? Code should look like:
Telerik.Windows.Controls.CommandManager.RegisterClassCommandBinding(
typeof
(RadGridView),
new
CommandBinding(yourCommand, OnExecuted, OnCanExecute));
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Ramin
Top achievements
Rank 1
answered on 22 Oct 2010, 06:00 PM
I use WPF RadControls.
I tried this:
I tried this:
Telerik.Windows.Controls.CommandManager.RegisterClassCommandBinding(typeof(RadGridView), new CommandBinding(yourCommand, OnExecuted, OnCanExecute));
And I got this error:
The type or namespace name 'CommandManager' does not exist in the namespace 'Telerik.Windows.Controls' (are you missing an assembly reference?) C:\DevLcl\GiftWPF\GiftWPF\Forms\XpubPanel.xaml.cs 71 38 GiftWPF
0
Hello Ramin,
Could you please send me an isolated project which I can debug on my side, and I'll do my best to resolve the problem?
Thank you in advance.
P.S. You should open a separate support ticket in order to be able to attach files.
Regards,
Nedyalko Nikolov
the Telerik team
Could you please send me an isolated project which I can debug on my side, and I'll do my best to resolve the problem?
Thank you in advance.
P.S. You should open a separate support ticket in order to be able to attach files.
Regards,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Lynne
Top achievements
Rank 1
answered on 26 Oct 2011, 07:47 PM
Would you please update the currently-invalid blog entry link in your message?
0
Hello Lynne,
Maya
the Telerik team
The updated link to the blog post is this one. You can also run through our online documentation for further reference.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>