Imports Syncfusion.WinForms.Core.Utils
Private Sub SfDataGrid1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As Syncfusion.WinForms.DataGrid.Events.CurrentCellKeyEventArgs)
If Me.sfDataGrid1.IsAddNewRowIndex(Me.sfDataGrid1.CurrentCell.RowIndex) AndAlso e.KeyEventArgs.KeyCode = Keys.Escape AndAlso sfDataGrid1.View.CurrentAddItem IsNot Nothing Then
If Me.sfDataGrid1.CurrentCell.IsEditing Then
Me.sfDataGrid1.CurrentCell.EndEdit(True)
End If
Dim gridModel = ReflectionHelper.GetProperty(GetType(SfDataGrid), "GridModel").GetValue(sfDataGrid1, Nothing)
Dim addNewRowController = ReflectionHelper.GetProperty(gridModel.GetType(), "AddNewRowController").GetValue(gridModel, Nothing)
Dim cancelAddNewMethod = ReflectionHelper.GetMethod(addNewRowController.GetType(), "CancelAddNew")
ReflectionHelper.Invoke(cancelAddNewMethod, addNewRowController, New Object() { })
End If
|
Imports Syncfusion.WinForms.Core.Utils Private Sub SfDataGrid1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As Syncfusion.WinForms.DataGrid.Events.CurrentCellKeyEventArgs)
If Me.sfDataGrid1.IsAddNewRowIndex(Me.sfDataGrid1.CurrentCell.RowIndex) AndAlso e.KeyEventArgs.KeyCode = Keys.Escape AndAlso sfDataGrid1.View.CurrentAddItem IsNot Nothing Then
If Me.sfDataGrid1.CurrentCell.IsEditing Then
Me.sfDataGrid1.CurrentCell.EndEdit(True)
End If
Dim gridModel = ReflectionHelper.GetProperty(GetType(SfDataGrid), "GridModel").GetValue(sfDataGrid1, Nothing)
Dim addNewRowController = ReflectionHelper.GetProperty(gridModel.GetType(), "AddNewRowController").GetValue(gridModel, Nothing)
Dim cancelAddNewMethod = ReflectionHelper.GetMethod(addNewRowController.GetType(), "CancelAddNew")
ReflectionHelper.Invoke(cancelAddNewMethod, addNewRowController, New Object() { })
this.sfDataGrid.ClearSelection(); End If
|