Represents a service that provides properties and events to control the display and behavior of tooltips.
Assembly: PresentationFramework (in PresentationFramework.dll)
You define a tooltip for an element by setting the FrameworkContentElement.ToolTip or FrameworkElement.ToolTip property. The ToolTip property takes one child. The content of the child can vary from a simple text string to more complex content such as a StackPanel that has embedded text and Image elements.
You can define tooltip content as a ToolTip object, but this is not required. When you do not define the tooltip content as a ToolTip object, you can use the properties to position and customize the tooltip content. The class attached properties are used to determine the placement, behavior, and appearance of a tooltip. These properties are set on the element that defines the tooltip.
The ToolTip class and the class share many of the same properties that are used to customize a tooltip. If equivalent ToolTip and properties are both set, the property takes precedence. For example, if both the ToolTip.Placement property and the ToolTipService.Placement property are set for a System.Windows.Controls.ToolTip object, the value of the ToolTipService.Placement property is used.
The following timing properties are only defined for the class and are used by all tooltips:
Placement, PlacementRectangle, PlacementTarget, HorizontalOffset, and VerticalOffset behave similarly to the properties of the same name in the Popup class. For more information, see Popup Placement Behavior.
The following example shows how the use the class to specify the behavior of a tooltip. You set the properties of the class by attaching them directly to the element that exposes the tooltip.
<Ellipse Height="25" Width="50" Fill="Gray" HorizontalAlignment="Left" ToolTipService.InitialShowDelay="1000" ToolTipService.ShowDuration="7000" ToolTipService.BetweenShowDelay="2000" ToolTipService.Placement="Right" ToolTipService.PlacementRectangle="50,0,0,0" ToolTipService.HorizontalOffset="10" ToolTipService.VerticalOffset="20" ToolTipService.HasDropShadow="false" ToolTipService.ShowOnDisabled="true" ToolTipService.IsEnabled="true" ToolTipOpening="whenToolTipOpens" ToolTipClosing="whenToolTipCloses" > <Ellipse.ToolTip> <BulletDecorator> <BulletDecorator.Bullet> <Ellipse Height="10" Width="20" Fill="Blue"/> </BulletDecorator.Bullet> <TextBlock>Uses the ToolTipService class</TextBlock> </BulletDecorator> </Ellipse.ToolTip> </Ellipse>
|How to: Position a ToolTip||This example shows how to specify the position of a tooltip on the screen.|
|How to: Use the BetweenShowDelay Property||This example shows how to use the BetweenShowDelay time property so that tooltips appear quickly—with little or no delay—when a user moves the mouse pointer from one tooltip directly to another.|
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.