Category / Section
How to set tooltip for cells in WinForms GridListControl?
2 mins read
The tooltip can be set for the cells using CellTipText property and this property can be set by handling the QueryCellInfo event in WinForms GridListControl.
C#
//Event subscription.
this.gridListControl1.Grid.QueryCellInfo += Grid_QueryCellInfo;
//Handling the QueryCellInfo event.
private void Grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.RowIndex != 0)
e.Style.CellTipText = e.Style.CellValue.ToString();
}
VB
'Event subscriptions
AddHandler Me.gridListControl1.Grid.QueryCellInfo, AddressOf Grid_QueryCellInfo
'Handling the QueryCellInfo event
Private Sub Grid_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
If e.RowIndex <> 0 Then
e.Style.CellTipText = e.Style.CellValue.ToString()
End If
End Sub
The image illustrates the tooltip displayed in the GridListControl.
Samples:
C#: Tooltip
VB: Tooltip