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

ToolTip & ScreenTip

When interacting with a cell in the RadHeatMap control, you have the option to display either a RadToolTip or a ScreenTip when the mouse is positioned over the cell or a group. This behavior can be configured using the ToolTipDisplayMode property. By default, the ToolTipDisplayMode is set to ScreenTip. This property is enumeration and expose the following values.

  • None: Does not display tool or screen tips.
  • ScreenTip: When set to ScreenTip, a screen tip is displayed when the mouse is over a cell. The screen tip typically provides more detailed information about the cell's content or purpose.
  • ToolTip: When set to ToolTip, a RadToolTip is displayed when the mouse is over a cell or a group.

The choice between using RadToolTip or ScreenTip depends on your specific requirements and the functionality you need to achieve. If you need a simple tooltip with basic text content for a specific control, RadToolTip would be sufficient. On the other hand, if you require a more feature-rich tooltip with additional elements, such as images or complex content, ScreenTip would be a better choice.

WinForms RadHeatMap ScreenTip

Customization

Customization of the ToolTip or ScreenTip is possible through two events:

  • ScreenTipShowing: Occurs when the screen tip is about to be shown. Cancellable.
  • ToolTipShowing: Occurs when the tool tip is about to be shown. Cancellable.

In this example, we will customize the ScreenTip visual appereance. For this purpose we will subscribe to the ScreenTipShowing event. In the event handler, we have access to the ScreenTip object, its properties and the currently hovered cell index. Using the Index property from the event arguments, we can get the data object underneath.

Example 1: ScreenTipShowing Event

private void RadHeatMap1_ScreenTipShowing1(object sender, HeatMapScreenTipEventArgs e)
{
    if(e.Index.IsDataCell)
    {
        var heatMap = sender as RadHeatMapElement;
        var heatMapItem = heatMap.Definition.GetDataItem(e.Index);
        var dataBoundObject = heatMapItem.DataBoundItem as TempInfo;
        e.CaptionText = "Cell Value: " + e.CaptionText;
        e.Text = "Row Data: "+dataBoundObject.Year.ToString("yyyy") + " Column Data: " + dataBoundObject.Month;
        e.FooterText = "RowIndex: " + e.Index.RowIndex + " ColumnIndex: " + e.Index.ColumnIndex;
    }            
}



Private Sub RadHeatMap1_ScreenTipShowing1(ByVal sender As Object, ByVal e As HeatMapScreenTipEventArgs)
    If e.Index.IsDataCell Then
        Dim heatMap = TryCast(sender, RadHeatMapElement)
        Dim heatMapItem = heatMap.Definition.GetDataItem(e.Index)
        Dim dataBoundObject = TryCast(heatMapItem.DataBoundItem, TempInfo)
        e.CaptionText = "Cell Value: " & e.CaptionText
        e.Text = "Row Data: " & dataBoundObject.Year.ToString("yyyy") & " Column Data: " + dataBoundObject.Month
        e.FooterText = "RowIndex: " & e.Index.RowIndex & " ColumnIndex: " + e.Index.ColumnIndex
    End If
End Sub


WinForms RadHeatMap ScreenTip ScreenTipShowing

See Also

In this article