Hi,
I am trying to Delete a Row with the Delete Key from the KeyDown event. I have the DeleteKeyAction set to Delete Selected Rows (but have tried all 4 options) and I have RowSelection set to single but also tried multiple.
My problem is that the KeyDown event will only fire if I select a cell. It does not fire when I just have a row selected. I've included my grid loading and keydown event code.
Private Sub idgQuotesDetail_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles idgQuotesDetail.Loaded Me.idgQuotesDetail.SelectionSettings.RowSelection = Infragistics.Silverlight.SelectionType.Single Me.idgQuotesDetail.SelectionSettings.CellSelection = Infragistics.Silverlight.SelectionType.Single Me.idgQuotesDetail.RowSelectorSettings.Visibility = Windows.Visibility.Visible Me.idgQuotesDetail.DeleteKeyAction = Infragistics.Silverlight.DeleteKeyAction.DeleteSelectedRows Me.idgQuotesDetail.EditingSettings.AllowEditing = Infragistics.Silverlight.EditingType.Cell Me.idgQuotesDetail.EditingSettings.IsMouseActionEditingEnabled = Infragistics.Silverlight.MouseEditingAction.SingleClick Me.idgQuotesDetail.PagerSettings.AllowPaging = Infragistics.Silverlight.PagingLocation.Bottom Me.idgQuotesDetail.PagerSettings.PageSize = 6 Me.idgQuotesDetail.SortingSettings.AllowSorting = True Me.idgQuotesDetail.SortingSettings.AllowMultipleColumnSorting = True End Sub
Private Sub idgQuotesDetail_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles idgQuotesDetail.KeyDown Select Case e.Key Case Key.Insert AddNewQuoteDetail() Case Key.Delete DeleteCurrentRow() End Select End Sub
Is this a bug or am I missing something?
Thanks,
Lisa.
From the code you provided it seems like you are trying to delete the row on your own when the "Delete" key is pressed. However, when you set DeleteKeyAction, the Grid automatically removes the corresponding rows based on your DeleteKeyAction setting.
Could you try if this will work for you?
This might be related to the fact that the event is not firing, but we will look further in that, it might be an issue.
HTH,
Well we have to run some validations to confirm that the row is allowed to be deleted but it doesn't even get there. The problem is that the event wont fire. It works fine if I select a cell and then press the delete key.