ToolTipService.PlacementTarget attached property

Applies to Windows and Windows Phone

Gets or sets the object relative to which a tooltip is positioned.


<object ToolTipService.PlacementTarget="{Binding ElementName=referenceToTarget}"/>

XAML Values

referenceToTarget

The Name or x:Name of the UI element that serves as the placement target. This syntax assumes that the working data context contains the named element, and that there are no visual tree disconnects such as attempting to reference a UserControl or a template part.

Remarks

If there is no explicit PlacementTarget, the placement target for a ToolTip is the element that specifies a value for its TooltipService.ToolTip attached property value. Any Placement value (either as an attached property or as an attribute on an explicit ToolTip element) applies to that target.

TooltipService.Placement and TooltipService.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, or you want to focus attention on only the active elements in a UI. For example, if there is an icon Image and an adjacent control TextBox in your UI composition, it might be appropriate to target the TextBox as the placement target for the tooltip when the user places the pointer over the Image.

TooltipService.PlacementTarget is an attached property, which supports a XAML usage. When setting this property in code, use SetPlacementTarget instead. When getting this property in code, use GetPlacementTarget instead. In code usages, the target parameter is the object where the attached property value is set. Another way to get or set the value in code is to use the dependency property system, calling either GetValue or SetValue and passing PlacementTargetProperty as the dependency property identifier.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls

Metadata

Windows.winmd

See also

ToolTipService
ToolTipService
Attached properties overview

 

 

Show:
© 2014 Microsoft