How disable row selection when using Ctrl + Shift+ Up or Down key in xamdatagrid?

198 Views Asked by At

I have a grid in which if I press Ctrl+Shift+Down or up, the xamdatagrid selects the row until the column in next/previous row. How do I disable the selection of row when these keys are down?

1

There are 1 best solutions below

0
mm8 On

You could handle the PreviewKeyDown event:

xamDataGrid1.PreviewKeyDown += (s, e) => 
{
    if ((e.Key == Key.Down || e.Key == Key.Up)
        && (Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift))
    {
        e.Handled = true;
        MessageBox.Show("CTRL + SHIFT + Up/Down detected!");
    }
};