ToolTipService Class
Represents a service that provides static methods to display a tooltip.
Namespace: System.Windows.Controls
Assembly: System.Windows (in System.Windows.dll)
The ToolTipService type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | Placement | Gets or sets the position of the tooltip in relation to its target visual element. |
![]() ![]() | PlacementTarget | Gets or sets the visual element that the tooltip should be positioned in relation to. |
![]() ![]() | ToolTip | Gets or sets a tooltip to be attached to a control. |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | GetPlacement | Gets the relative position of the specified tooltip. |
![]() ![]() ![]() | GetPlacementTarget | Gets the visual element that the tooltip is positioned relative to. |
![]() ![]() ![]() | GetToolTip | Gets the tooltip for an object. |
![]() ![]() ![]() | SetPlacement | Sets the position of the specified ToolTip using the specified placement mode. |
![]() ![]() ![]() | SetPlacementTarget | Sets the position of the specified ToolTip relative to the specified value element. |
![]() ![]() ![]() | SetToolTip | Sets the tooltip for an object. |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | PlacementProperty | Identifies the Placement dependency property. |
![]() ![]() ![]() | PlacementTargetProperty | Identifies the PlacementTarget dependency property. |
![]() ![]() ![]() | ToolTipProperty | Identifies the ToolTip dependency property. |
To display a tooltip for a control you must use the ToolTipService class. Use the static SetToolTip and GetToolTip methods to set and get the tooltip for a control.
The following code example demonstrates the placement modes for a tooltip.
<Border BorderThickness="3" BorderBrush="Black"> <StackPanel Background="LightGray"> <TextBlock Text="ToolTip Control" Margin="5" /> <StackPanel x:Name="LayoutRoot" Orientation="Horizontal"> <TextBlock TextWrapping="Wrap" Width="150" Text="Hover over an item to see its ToolTip: " Margin="5" VerticalAlignment="Center" /> <ListBox Width="100" x:Name="myListBox" ToolTipService.ToolTip="ToolTip" ToolTipService.Placement="Right" > <ListBox.Items> <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 mouse." ToolTipService.Placement="Mouse"/> </ListBox.Items> </ListBox> </StackPanel> </StackPanel> </Border>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.




