ToolTipControlInfo.Object Property

Gets or sets an object which uniquely identifies the currently processed element.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v20.1.dll

Declaration

public object Object { get; set; }
Public Property Object As Object

Property Value

Type Description
Object

An object which uniquely identifies the currently processed element.

Remarks

See the ToolTipController.GetActiveObjectInfo topic for more information.

Examples

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.

ToolTipController_GetActiveObject

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;
}
See Also