Dela via


ToolTip.PlacementTarget Property

Definition

Gets or sets the visual element or control that the tool tip should be positioned in relation to when opened by the ToolTipService.

public:
 property UIElement ^ PlacementTarget { UIElement ^ get(); void set(UIElement ^ value); };
UIElement PlacementTarget();

void PlacementTarget(UIElement value);
public UIElement PlacementTarget { get; set; }
var uIElement = toolTip.placementTarget;
toolTip.placementTarget = uIElement;
Public Property PlacementTarget As UIElement
<ToolTip PlacementTarget="{Binding ElementName=placementTargetName}"/>

Property Value

The visual element or control that the tool tip is positioned in relation to when opened by the ToolTipService. The default is null.

Remarks

If there is no explicit PlacementTarget, the placement target for a ToolTip is the element that specifies the ToolTip as the value for its TooltipService.ToolTip attached property value, and any Placement value applies to that target. The placement target determination is based on visual tree composition, and whether to display a tooltip at all is parallel to the target's hit test characteristics. A Control instance where IsEnabled is false will not display a ToolTip.

Placement and PlacementTarget are usually left as the defaults. The scenario for specifying either or both of these properties is if you are trying to avoid a case where the tooltip obscures the content it is referring to while the tooltip is displayed.

Applies to

See also