How to retrieve current record on cell double click in WinForms GridGroupingControl?
CellDoubleClick event
The TableControlCellDoubleClick/TableControl.CellDoubleClick event
can be used to notify whenever the double click on a cell occurrs. For further
information about the event, TableControlCellDoubleClick .
In order to retrieve the current selected record when the cell double click occurrs, the SelectedRecords collection can be used to retrieve record, which is available from the TableControl in the event arguments. To get the values of particular column, the GetValue method of the record can be used.
Using TableControlCellDoubleClick event
C#
//Event triggering
this.gridGroupingControl1.TableControlCellDoubleClick += GridGroupingControl1_TableControlCellDoubleClick;
//Event customization
private void GridGroupingControl1_TableControlCellDoubleClick(object sender, GridTableControlCellClickEventArgs e)
{
if (e.TableControl.Table.SelectedRecords.Count > 0)
{
Record selectedRecord;
if (gridGroupingControl1.TableOptions.ListBoxSelectionMode == SelectionMode.One)
{
//To get the selected record when selection mode is one
selectedRecord = e.TableControl.Table.SelectedRecords[0].Record;
}
else
{
//To get the selected record for other selection modes
int count = e.TableControl.Table.SelectedRecords.Count;
selectedRecord = e.TableControl.Table.SelectedRecords[count - 1].Record;
}
//To show the new form
DisplayForm displayForm = new DisplayForm(selectedRecord);
displayForm.Show();
}
} VB
'Event triggering
AddHandler Me.gridGroupingControl1.TableControlCellDoubleClick, AddressOf GridGroupingControl1_TableControlCellDoubleClick
Private Sub GridGroupingControl1_TableControlCellDoubleClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
If e.TableControl.Table.SelectedRecords.Count > 0 Then
Dim selectedRecord As Record
If gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One Then
'To get the selected record when selection mode Is one
selectedRecord = e.TableControl.Table.SelectedRecords(0).Record
Else
'To get the selected record for other selection modes
Dim count As Integer = e.TableControl.Table.SelectedRecords.Count
selectedRecord = e.TableControl.Table.SelectedRecords(count - 1).Record
End If
'To show the New form
Dim displayForm As New DisplayForm(selectedRecord)
displayForm.Show()
End If
End Sub Using
TableControl.CellDoubleClick event
C#
//Event triggering
this.gridGroupingControl1.TableControl.CellDoubleClick += TableControl_CellDoubleClick;
//Event customization
private void TableControl_CellDoubleClick(object sender, GridCellClickEventArgs e)
{
if (e.TableControl.Table.SelectedRecords.Count > 0)
{
Record selectedRecord;
if (gridGroupingControl1.TableOptions.ListBoxSelectionMode == SelectionMode.One)
{
//To get the selected record when selection mode is one
selectedRecord = gridGroupingControl1.Table.SelectedRecords[0].Record;
}
else
{
//To get the selected record for other selection modes
int count = gridGroupingControl1.Table.SelectedRecords.Count;
selectedRecord = gridGroupingControl1.Table.SelectedRecords[count - 1].Record;
}
//To show the new form
DisplayForm displayForm = new DisplayForm(selectedRecord);
displayForm.Show();
}
}
VB
'Event triggering
AddHandler Me.gridGroupingControl1.TableControl.CellDoubleClick, AddressOf TableControl_CellDoubleClick
'Event customization
Private Sub TableControl_CellDoubleClick (ByVal sender As Object, ByVal e As GridCellClickEventArgs)
If e.TableControl.Table.SelectedRecords.Count > 0 Then
Dim selectedRecord As Record
If gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One Then
'To get the selected record when selection mode Is one
selectedRecord = gridGroupingControl1.Table.SelectedRecords(0).Record
Else
'To get the selected record for other selection modes
Dim count As Integer gridGroupingControl1.Table.SelectedRecords.Count
selectedRecord = gridGroupingControl1.Table.SelectedRecords(count - 1).Record
End If
'To show the New form
Dim displayForm As New DisplayForm(selectedRecord)
displayForm.Show()
End If
End SubDoubleClick Event is shown in the screenshot below

Samples: