Hello,In the XamDataGrid I am trying to do something like this:private void dataGrid_KeyDown(object sender, KeyEventArgs e){ if (e.Key == Key.Up) { dataGrid.ExecuteCommand(DataPresenterCommands.EndEditModeAndAcceptChanges); dataGrid.ExecuteCommand(DataPresenterCommands.CellAbove); dataGrid.ExecuteCommand(DataPresenterCommands.StartEditMode); e.Handled = true; }}The problem I am having is that when I am in Edit mode of the cell, this event does not seem to be fired (I checked by adding a Console.WriteLine() as the first line. This strategy worked well for me using the UltraWinGrid in Winforms. Is it just not intended to work that way in the WPF version?Thanks in advance!
Hello,
In this case, it sounds like you have to use tunneling equivallent event PreviewKeyDown
This works for the Up/Down Key events, but there doesn't seem to be a Key event for the Right/Left events, is there a workaround for this?
Thanks
This is what worked for me:private void dataGrid_PreviewKeyDown(object sender, KeyEventArgs e){ if (e.Key == Key.Up) { //Insert code here } else if (e.Key == Key.Down || e.Key == Key.Enter) { //Insert code here } else if (e.Key == Key.Left) { //Insert code here } else if (e.Key == Key.Right) { //Insert code here }}
Ah of course..silly me. I incorrectly assumed what KeyUp/KeyDown were doing..