ContextItem.CustomToolTip Event

Allows the hint for the current item to be customized. This event is only raised for RatingContextButton objects.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v20.1.dll

Declaration

public event ContextButtonToolTipEventHandler CustomToolTip
Public Event CustomToolTip As ContextButtonToolTipEventHandler

Event Data

The CustomToolTip event's data class is DevExpress.Utils.ContextButtonToolTipEventArgs.

Remarks

The CustomToolTip event is only raised for RatingContextButton objects whose hint text is not specified using the ContextItem.ToolTip property. This event fires each time a grading point of the current RatingContextButton object is hovered over with the mouse cursor. Handling the CustomToolTip event allows you to customize the hint for each point of the grading scale.

The Item property of the ContextButtonToolTipEventArgs object passed to the event handler allows you to determine the context item being processed. The ContextButtonToolTipEventArgs.Value property returns an integer value that specifies the grading scale point (from 1 to 5) hovered with the mouse cursor. To specify the text for the hint, use the ContextButtonToolTipEventArgs.Text property. Thus, you can provide a custom hint for each grading scale point. The sample event handler below shows how to implement this feature.


void Form1_CustomToolTip(object sender, DevExpress.Utils.ContextButtonToolTipEventArgs e) {
    switch (e.Value) {
        case 1:
            e.Text = "Very poor";
            break;
        case 2:
            e.Text = "Bad";
            break;
        case 3:
            e.Text = "Average";
            break;
        case 4:
            e.Text = "Good";
            break;
        case 5:
            e.Text = "Excellent";
            break;
        default: 
            e.Text = String.Empty;
            break;
    }

}

After the CustomToolTip event is fired, the CustomContextButtonToolTip event of the owner control fires. This event allows you to customize hints for RatingContextButton objects displayed in the owner control in a centralized way.

See Also