跳到主要内容
版本:11.0.0

Tool Tip

The tool tip is a popup that shows its content when the user hovers over the 'host' control to which it is attached.

Useful Properties

You will probably use these properties most often:

PropertyDescription
ToolTip.TipAttached property for the tooltip contents.
ToolTip.PlacementDefines the placement for the tooltip relative to the host or the pointer. Choose from top, bottom, left, right, anchor and gravity, pointer. The default value is pointer which places the tip content at the position where the pointer stops moving.
ToolTip.HorizontalOffsetThe tooltip horizontal offset from the placement (default 0).
ToolTip.VerticalOffsetThe tooltip vertical offset from the placement (default 20).
ToolTip.ShowDelayThe amount of time the pointer has to be still before the tooltip appears. In microseconds (default 400).

Examples

This is a simple text-based tooltip, using default values for the placement and delay properties; this rectangle is placed in a window with larger dimensions:

<Rectangle Fill="Aqua" Height="200" Width="400"
ToolTip.Tip="This is a rectangle" />

To provide a richer presentation for a tooltip, use a <ToolTip.Tip> element. For example:

<Rectangle Fill="Aqua" Height="200" Width="400"
ToolTip.Placement="Bottom">
<ToolTip.Tip>
<StackPanel>
<TextBlock FontSize="16">Rectangle</TextBlock>
<TextBlock>Some explanation here.</TextBlock>
</StackPanel>
</ToolTip.Tip>
</Rectangle>

More Information

信息

For the complete API documentation about this control, see here.

信息

View the source code on GitHub ToolTip.cs