ToolTip.Placement property

Applies to Windows and Windows Phone

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

Syntax


public PlacementMode Placement { get; set; }


<ToolTip Placement="placementModeMemberName"/>

XAML Values

placementModeMemberName

A named constant of the PlacementMode enumeration, such as Top.

Property value

Type: PlacementMode

One of the PlacementMode values.

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.

Examples

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


<StackPanel Margin="120" >
<TextBlock Text="ToolTip Control" Margin="5" 
           Style="{StaticResource HeaderTextStyle}" />
<TextBlock Text="Hover over an item to see its ToolTip: " 
           Style="{StaticResource ItemTextStyle}" Margin="10" />
<ListBox Width="100">
    <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>


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
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

ToolTip
PlacementMode
PlacementTarget

 

 

Show:
© 2014 Microsoft