RatingControl.BeforeShowToolTip Event
Occurs when the mouse pointer hovers over a rating scale item and allows you to display a unique hint for that item.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Event Data
The BeforeShowToolTip event's data class is RatingToolTipEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
HitTest | Gets information about the hit point. |
Text | Gets or sets tooltip content. |
Value | Gets the rating value. |
Remarks
The RatingControl supports regular and super tooltips. If the ShowToolTips option is enabled, tooltips are shown when the mouse pointer hovers the control.
Use the following properties to specify regular tooltip content:
- ToolTip — regular tooltip text. If the text is not specified, the tooltip is not displayed even if the title is specified. You can use line breaks in regular tooltips. Use the AllowHtmlTextInToolTip property to specify whether to parse HTML tags in the text. HTML tags allow you to format text: size, style, hyperlinks, etc.
- ToolTipTitle — a regular tooltip title. If the title is not specified, it is not displayed.
ToolTipIconType — a regular tooltip predefined icon. Use the controller’s IconSize property to specify the image size.
To display a custom image in all regular tooltips, use the controller’s ImageList and ImageIndex properties.
To display a custom image in a particular regular tooltip, handle the BeforeShow event. Use the ImageOptions event argument to assign a raster or vector image to the processed tooltip.
To assign a super tooltip to a control, use the SuperTip property. Enable the AllowHtmlText property to use HTML tags in the super tooltip.
To replace regular tooltips with super tooltips, set the ToolTipController.ToolTipType property to SuperTip. The controller automatically converts regular tooltips to super tooltips. To access this property, you can use the DefaultToolTipController component or a custom controller assigned to the ToolTipController property. See Hints and Tooltips for more information.
If you do not specify a regular or super tooltip, the control displays default tooltips that contain rating scale values. You can handle the control’s BeforeShowToolTip
event to display a custom tooltip for each rating value.
The control’s BeforeShowToolTip
and its repository item’s BeforeShowToolTip events are equivalent.
Note
These events do not fire if the control’s ToolTip property is set to a specific value.
Example
The code below shows how to display a unique tooltip for each rating grade.
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;
}
}