This documentation is archived and is not being maintained.

ToolTip Class

Updated: February 2009

Represents a control that creates a pop-up window that displays information for an element in the interface.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public class ToolTip : ContentControl

Content Model: ToolTip is a ContentControl. Its content property is Content. For more information on the content model for ToolTip, see Controls Content Model Overview.

You use a ToolTip control to provide information to the user. For example, you can use a ToolTip to provide the name of a Button or a ToolBar in a ToolBarTray. The content of a ToolTip control can vary from a simple text string to more complex content such as a StackPanel that has embedded text and images. The content of a ToolTip cannot receive focus.

A ToolTip control cannot have a parent. For example, you cannot set the Content property of a Button to a ToolTip Instead, assign a ToolTip to the FrameworkContentElement.ToolTip and FrameworkElement.ToolTip properties.

You can use a ToolTip on multiple elements by defining a ToolTip in a ResourceDictionary.

The properties of the ToolTip class are used to define the position and behavior of the tooltip. Many of these properties are also defined in the ToolTipService class. If the value of one of these properties is specified by both the ToolTip property and the ToolTipService attached property, the value of the ToolTipService property is used. In addition, the ToolTipService class provides properties to set timing behavior. These attached properties are not included in the ToolTip class but can be used by the control.

Dependency properties for this control might be set by the control’s default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see Themes.

This example shows how to define a tooltip control for a TextBox element.

The following example shows how to define a tooltip by assigning text to the ToolTip property.

<TextBox HorizontalAlignment="Left">TextBox with ToolTip
    <TextBlock>Useful information goes here.</TextBlock>

The following example shows how to define a tooltip by assigning a ToolTip object to the ToolTip property.

<TextBox HorizontalAlignment="Left">ToolTip with non-text content
      <DockPanel Width="50" Height="70">
        <Image Source="data\flower.jpg"/>
        <TextBlock>Useful information goes here.</TextBlock>

The following example uses code to generate a ToolTip object. The example creates a ToolTip (tt) and associates it with a Button.

button = new Button();
button.Content = "Hover over me.";
tt = new ToolTip();
tt.Content = "Created with C#";
button.ToolTip = tt;

More Code

How to: Position a ToolTip This example shows how to specify the position of a tooltip on the screen.
How to: Delay the Display of a ToolTip This example shows how to set a ToolTipService property that causes a brief delay before a ToolTip displays. You set the properties of the ToolTipService class by attaching them directly to the element that exposes the tooltip.
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.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 3.5, 3.0




February 2009

Described how default styles change dependency properties.

Customer feedback.