Skip to main content
A newer version of this page is available. .

RepositoryItemRatingControl.BeforeShowToolTip Event

Occurs when an end-user hovers over a rating item and allows you to display a unique hint for this item.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v19.2.dll

Declaration

[DXCategory("Events")]
public event RatingToolTipEventHandler BeforeShowToolTip

Event Data

The BeforeShowToolTip event's data class is DevExpress.XtraEditors.Repository.RatingToolTipEventArgs.

Remarks

The rating control’s BaseControl.ToolTip property sets a hint, displayed on hovering over any rating item of this control. However, if you need to display different hints for different rating items, leave this property without any value and handle the BeforeShowToolTip event instead. You can access three parameters from the event arguments:

  • e.Value - the value that the rating control will have (see the RatingControl.Rating property) if an end-user clicks the currently hovered rating item at the exact same point;
  • e.Text - the tooltip text;
  • e.HitTest - the hit test for the hovered point.

Important

The BeforeShowToolTip event is not fired if the BaseControl.ToolTip property is set to a specific value.

The code below illustrates how to set unique hints for the rating control with standard 5-grade marks.

ratingControl1.Properties.FillPrecision = DevExpress.XtraEditors.Repository.RatingItemFillPrecision.Full;

private void ratingControl1_BeforeShowToolTip(object sender, DevExpress.XtraEditors.Repository.RatingToolTipEventArgs e) {
    int value = Convert.ToInt32(e.Value);
    switch (value) {
        case 1: e.Text = "Very Bad";
            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;
    }
}

The result is shown in the animation below.

RatingControl - Custom Tooltips

See Also