This is a migrated thread and some comments may be shown as answers.

Up/Down keys KeyDownEvent

1 Answer 56 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 07 Dec 2012, 05:45 PM
Hello,
I am working on a RadGridView that requires the capability to move rows up and down within the grid, ideally I would like Alt+Up/Down to execute a command that moves the selected row up or down in the grid. What I've done is created a behavior that is attached to the grid and wires up to the KeyDownEvent or PreviewKeyDownEvent. My issue is that when I hit Up or Down neither of the events are fired. I understand that those keys are used for navigation but I want to handle the event when Alt+Up/Down is pressed but I can't seem to get either of the events when focused on the grid no matter what modifier keys I have pressed. Is there any way to get the KeyDownEvent/PreviewKeyDownEvent to fire for the Up/Down buttons on a RadDataGrid?

AssociatedObject.AddHandler( UIElement.KeyDownEvent, mKeyEventHandler, true );

EDIT: Using the 'preview' event handler directly (rather that AddHandler) appears to work so I'm past my issue. Thanks

AssociatedObject.PreviewKeyDown += _HandlePreviewKeyDown;


Thanks,
Jason

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 10 Dec 2012, 07:36 AM
Hello Jason,

You can try creating your own keyboard command provider and override the default one. Check out this article and this blog post for more information. 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Jason
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or