ToolTip.Placement Property

Definition

Gets or sets how a ToolTip is positioned in relation to the placement target element.

public:
 property PlacementMode Placement { PlacementMode get(); void set(PlacementMode value); };
PlacementMode Placement();

void Placement(PlacementMode value);
public PlacementMode Placement { get; set; }
var placementMode = toolTip.placement;
toolTip.placement = placementMode;
Public Property Placement As PlacementMode
<ToolTip Placement="placementModeMemberName"/>

Property Value

One of the PlacementMode values.

Examples

The following code example demonstrates the placement modes for a ToolTip.

<StackPanel Margin="120" >
    <TextBlock Text="ToolTip Control"/>
    <TextBlock Text="Hover over an item to see its ToolTip: " Margin="0,10"/>
    <ListBox Width="100" HorizontalAlignment="Left">
        <ListBoxItem Content="Left" 
            ToolTipService.ToolTip="ToolTip to the left." 
            ToolTipService.Placement="Left" />
        <ListBoxItem Content="Right" 
            ToolTipService.ToolTip="ToolTip to the right." 
            ToolTipService.Placement="Right" />
        <ListBoxItem Content="Top" 
            ToolTipService.ToolTip="ToolTip at the top." 
            ToolTipService.Placement="Top" />
        <ListBoxItem Content="Bottom" 
            ToolTipService.ToolTip="ToolTip at the bottom." 
            ToolTipService.Placement="Bottom"/>
        <ListBoxItem Content="Mouse" 
            ToolTipService.ToolTip="ToolTip based on the cursor position." 
            ToolTipService.Placement="Mouse"/>
    </ListBox>
</StackPanel>

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.

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