Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ToolTip Class
Collapse the table of content
Expand the table of content

ToolTip Class

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)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public class ToolTip : ContentControl
/** @attribute LocalizabilityAttribute(LocalizationCategory.ToolTip) */ 
public class ToolTip extends ContentControl
public class ToolTip extends ContentControl

Content Model: ToolTip is a ContentControl and has one content property: Content. For information about how to set this property, see the Content Control 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 is designed to be a possible value of the FrameworkContentElement.ToolTip and FrameworkElement.ToolTip properties.

A ToolTip control cannot have a parent, although it can be defined as a reusable resource. When you define a tooltip as a resource, it can be used by multiple elements.

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 ToolTipServiceattached 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.

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;

For the complete sample, see ToolTip Sample.

More Code

How to: Position a ToolTip

This example shows how to specify the position of a tooltip on the screen.

How to: Style a ToolTip

This example shows how to create and use a Style for a ToolTip control.

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2015 Microsoft