Skip to main content

ToolTipController.ToolTipAnchor Property

Gets or sets whether tooltips are anchored relative to the mouse pointer or relative to the owning control. This property is not in effect if you handle the ToolTipController.GetActiveObjectInfo event.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v23.2.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

[DefaultValue(ToolTipAnchor.Default)]
[DXCategory("ToolTip")]
public ToolTipAnchor ToolTipAnchor { get; set; }

Property Value

Type Default Description
DevExpress.Utils.ToolTipAnchor Default

A DevExpress.Utils.ToolTipAnchor value that specifies whether tooltips are anchored relative to the mouse pointer or relative to the owning control. By Default, tooltips are anchored relative to the mouse pointer.

Remarks

When displayed, tooltips are aligned according to the ToolTipController.ToolTipLocation setting relative to the anchor point, which is the mouse cursor or the owning control. The ToolTipAnchor property specifies the default anchor point for all tooltips controlled by this ToolTipController. If this setting is set to Default, tooltips are anchored relative to the mouse pointer.

If the ToolTipAnchor property is set to Cursor, tooltips are anchored relative to the mouse pointer. In this mode, a tooltip might overlap the current editor (for instance, when a large tooltip is displayed close to a screen edge). In the figure below, the tooltip for the RatingControl is anchored at the bottom right relative to the mouse pointer.

BaseEdit_ToolTipAnchor_Cursor

If the ToolTipAnchor property is set to Object, tooltips are anchored relative to the owning control. In this mode, tooltips never overlap the current control, no matter how big they are. In the following figure, the tooltip is anchored at the bottom right relative to the control.

BaseEdit_ToolTipAnchor_Object

The ToolTipAnchor setting can be overridden for a particular control using its ToolTipAnchor property. You can also dynamically anchor tooltips, while handling the ToolTipController.BeforeShow event, and specifying the ToolTipControllerShowEventArgs.ToolTipAnchor event argument.

You can set custom control bounds for the “Object” mode. To do this, handle the ToolTipController.GetActiveObjectInfo event.

toolTipController1.ToolTipAnchor = DevExpress.Utils.ToolTipAnchor.Object;

private void toolTipController1_GetActiveObjectInfo(
  object sender, DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs e) {
    ToolTipControlInfo info = new ToolTipControlInfo(this.button1, "Text");
    info.SuperTip = new SuperToolTip();
    info.SuperTip.Items.Add(new ToolTipTitleItem() { Text = "Title" });
    info.SuperTip.Items.Add(new ToolTipItem() { Text = "Text" });
    info.ObjectBounds = e.SelectedControl.RectangleToScreen(e.SelectedControl.ClientRectangle);
    e.Info = info;
}
See Also