Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
[LocalizabilityAttribute(LocalizationCategory.ToolTip)] public class ToolTip : ContentControl
/** @attribute LocalizabilityAttribute(LocalizationCategory.ToolTip) */ public class ToolTip extends ContentControl
LocalizabilityAttribute(LocalizationCategory.ToolTip) public class ToolTip extends ContentControl
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, 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 <TextBox.ToolTip> <TextBlock>Useful information goes here.</TextBlock> </TextBox.ToolTip> </TextBox>
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 <TextBox.ToolTip> <ToolTip> <DockPanel Width="50" Height="70"> <Image Source="data\flower.jpg"/> <TextBlock>Useful information goes here.</TextBlock> </DockPanel> </ToolTip> </TextBox.ToolTip> </TextBox>
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; cv2.Children.Add(button);
For the complete sample, see ToolTip Sample.
|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.
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 EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.