We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Key Capturing & Handling

Thread ID:

Created:

Updated:

Platform:

Replies:

124698 Jun 23,2016 04:31 AM Jun 29,2016 12:05 AM WPF 3
loading
Tags: GridControl
Marco Studer
Asked On June 23, 2016 04:31 AM

I am trying to capture the arrow keys in order to increment my data by a certain value. This works perfectly well using CurrentCellPreviewKeyDown. However, the arrow keys are also used for navigation. I am setting Handled = true after I captured the arrow keys but still the navigation does not stop.

How do I handle these keys correctly, so that the selection is not going to move when hitting the arrow keys?

Kanimozhi Bharathi [Syncfusion]
Replied On June 24, 2016 07:54 AM

Hi Marco Studer, 
 
Thank you for contacting Syncfusion Support. 
 
You can cancel the navigation while pressing arrow keys in GridControl by using CurrentCellPreviewKeyDown Event of GridControl like below code example 
 
 
grid.CurrentCellPreviewKeyDown += grid_CurrentCellPreviewKeyDown; 
 
void grid_CurrentCellPreviewKeyDown(object sender, GridCellKeyEventArgs args) 
{ 
     if(args.Key == Key.Down || args.Key == Key.Up || args.Key == Key.Left || args.Key == Key.Right) 
        args.Cancel = true; 
} 
 
Regards 
Kanimozhi B 


Marco Studer
Replied On June 28, 2016 06:05 AM

Thank you very much, work like a charm!

Kanimozhi Bharathi [Syncfusion]
Replied On June 29, 2016 12:05 AM

Hi Marco Studer, 
Thank you for your update. 
Regards 
Kanimozhi B 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;