Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
Disable keyboard selection?
posted

Hi,

Is there a way to disable keyboard selection in the grid?  i.e. I want to disable Shift-Up/Down arrow key and Ctrl-Space, but still allow navigation with the up/down arrow key.

Thanks,

Harold

  • 35319
    Verified Answer
    posted

    Hello Harold,

     

    I have been looking into your question and I can suggest you handle the ‘PreviewKeyDown’ event of the XamDataGrid and disable this keys combination like e.g. :

     

         private void xamDataGrid1_PreviewKeyDown(object sender, KeyEventArgs e)

            {

                if ((e.Key == Key.Up && Keyboard.Modifiers == ModifierKeys.Shift) || (e.Key == Key.Down && Keyboard.Modifiers == ModifierKeys.Shift) || (e.Key == Key.Space && Keyboard.Modifiers == ModifierKeys.Control))

                {

                    e.Handled = true;

                }

            }

     

     

    If you need any further assistance on this matter, feel free to ask.