ToolTipControllerGetActiveObjectInfoEventArgs.Info Property
Gets or sets an object which uniquely identifies the visual element at the current position.
Namespace: DevExpress.Utils
Assembly: DevExpress.Utils.v20.2.dll
NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core
Declaration
Property Value
Type | Description |
---|---|
ToolTipControlInfo | A ToolTipControlInfo object which identifies the visual element at the current position. |
Remarks
The ToolTipController.GetActiveObjectInfo event is called repeatedly when the mouse cursor moves over a control. To display a hint for the control’s specific element, check the current mouse position and if the mouse hovers over the required element assign a ToolTipControlInfo object containing tooltip information to the event’s Info parameter. The ToolTipControlInfo.Text property must specify the hint to display. The ToolTipControlInfo.Object property must be set to a value that uniquely identifies the current element.
The value of the ToolTipControlInfo.Object property is used as an identifier. To display different tooltips for a control’s elements, different ToolTipControlInfo objects with different values of the ToolTipControlInfo.Object properties must be used. If you assign the same ToolTipControlInfo object to the Info parameter as in the previous event call the tooltip will not be redisplayed even if a new tooltip text is specified.
If you assign a new ToolTipControlInfo object but the object assigned to the ToolTipControlInfo.Object property is the same as in the previous event call, the tooltip will not be redisplayed either. If you assign a new ToolTipControlInfo object to the parameter and change the ToolTipControlInfo.Object property as compared to the previous event call, the previous hint will be hidden and the new hint will be displayed.
Example
The following example demonstrates a way of implementing custom tooltips for row indicator cells in the XtraGrid control. By default, the grid control does not support tooltips for row indicator cells. To provide tooltips, drop the ToolTipController component onto the grid’s form, assign it to the grid control’s EditorContainer.ToolTipController property and handle the ToolTipController.GetActiveObjectInfo event.
In our example, the tooltips will display the “Row N” text where N is the ordinal number of a row.
using DevExpress.Utils;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
//...
private void toolTipController1_GetActiveObjectInfo(object sender,
ToolTipControllerGetActiveObjectInfoEventArgs e) {
if(e.SelectedControl != gridControl1) return;
ToolTipControlInfo info = null;
//Get the view at the current mouse position
GridView view = gridControl1.GetViewAt(e.ControlMousePosition) as GridView;
if(view == null) return;
//Get the view's element information that resides at the current position
GridHitInfo hi = view.CalcHitInfo(e.ControlMousePosition);
//Display a hint for row indicator cells
if(hi.HitTest == GridHitTest.RowIndicator) {
//An object that uniquely identifies a row indicator cell
object o = hi.HitTest.ToString() + hi.RowHandle.ToString();
string text = "Row "+ hi.RowHandle.ToString();
info = new ToolTipControlInfo(o, text);
}
//Supply tooltip information if applicable, otherwise preserve default tooltip (if any)
if (info != null)
e.Info = info;
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Info property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.