Is there a way when I press enter in the Xamdatagrid to move to the cell below and begin edit mode? I tried the following below but I have to press Enter twice for it to work and I wont to only press enter once.
private void AwrdsDataGrid_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (Keyboard.IsKeyDown(Key.Enter)) { this.CoreItemDatagrid.ExecuteCommand(DataPresenterCommands.CellBelow); this.CoreItemDatagrid.ExecuteCommand(DataPresenterCommands.StartEditMode); } }
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
That helped, thanks.
Thank you for your post. I have been looking into it and I can suggest you use the XamDataGrid’s PreviewKeyDown event instead of KeyDown and modify the code in the handler like this:
if (Keyboard.IsKeyDown(Key.Enter)) { Dispatcher.BeginInvoke(new Action(() => { this.CoreItemDatagrid.ExecuteCommand(DataPresenterCommands.CellBelow); this.CoreItemDatagrid.ExecuteCommand(DataPresenterCommands.StartEditMode); }), DispatcherPriority.Background, null); }
Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.