New to Telerik UI for WinForms? Download free 30-day trial

ToolTips

There are two ways to assign tooltips to cells in RadVirtualGrid, namely setting the ToolTipText property of a VirtualGridCellElement in the CellFormatting event handler, or as in most of the RadControls by using the ToolTipTextNeeded event.

Setting tooltips in the ToolTipTextNeeded event

The code snippet below demonstrates how you can use the ToolTipTextNeeded event handler to set ToolTipText for the given VirtualGridCellElement.

WinForms RadVirtualGrid Setting tooltips in the ToolTipTextNeeded event


private void radVirtualGrid1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
{
    VirtualGridCellElement virtualCell = sender as VirtualGridCellElement;
    if (virtualCell != null)
    {
        e.ToolTipText = "Tooltip: " + virtualCell.Value + "";
    }
}

Private Sub radVirtualGrid1_ToolTipTextNeeded(sender As Object, e As ToolTipTextNeededEventArgs)
    Dim virtualCell As VirtualGridCellElement = TryCast(sender, VirtualGridCellElement)
    If virtualCell IsNot Nothing Then
        e.ToolTipText = "Tooltip: " + virtualCell.Value + ""
    End If
End Sub

Setting tooltips in the CellFormatting event handler

The code snippet below demonstrates how you can assign a tooltip to a cell in RadVirtualGrid.

WinForms RadVirtualGrid Setting tooltips in the CellFormatting event handler


private void radVirtualGrid1Tooltips_CellFormatting(object sender, VirtualGridCellElementEventArgs e)
{
    if (e.CellElement.RowIndex >= 0)
    {
        e.CellElement.ToolTipText = e.CellElement.Value + "";
    }
}

Private Sub radVirtualGrid1Tooltips_CellFormatting(sender As Object, e As VirtualGridCellElementEventArgs)
    If e.CellElement.RowIndex >= 0 Then
        e.CellElement.ToolTipText = e.CellElement.Value + ""
    End If
End Sub

The ToolTipTextNeeded event has higher priority and overrides the tooltips set in the CellFormatting event handler.

See Also

In this article