Thank you for using syncfusion products. We have analyzed your query, PrivewKeyDown event is not called while pressing escape key and grid is having focus. This is happening because when the grid is having focus , and on edit mode, pressing escape will be handled by the Grid's PreviewKeyDown and keyDown events. In edit mode , Escape key will have different functionality of disabling the edit mode for the current cell. you can override the grid's KeyDown event to meet your requirement . please refer the code snippet :
this.grid.PreviewKeyDown+=grid_PreviewKeyDown;
private void grid_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
Console.WriteLine("KeyDown with escape key is
handled");
}
else Console.WriteLine("Key down without esc is
handled");
}
|
if you still want the escape key to be handled in main view's keydown event, we can provide a work around sample.
Please let us know if you have any queries.
Regards,
Deepak raj Sundar.