ToolTipService.ToolTip attached property

Applies to Windows and Windows Phone

Gets or sets the object or string content of an element's ToolTip.


<object ToolTipService.ToolTip="text"/>


<object>
  <ToolTipService.ToolTip>
    singleObject
  </ToolTipService.ToolTip>
</object>

XAML Values

singleObject

An object element that serves as tooltip content. Use discretion when using objects as tooltip content. Not all UI objects are suitable for use within the limited presentation surface that appears for tooltips. You can also specify an explicit ToolTip object element, which wraps any content or specifies its own Content as text.

Remarks

ToolTipService.ToolTip is an attached property, which supports a XAML usage. When setting this property in code, use SetToolTip instead. When getting this property in code, use GetToolTip instead. In code usages, the target parameter is the object where the attached property value is set. Another way to get or set the value in code is to use the dependency property system, calling either GetValue or SetValue and passing ToolTipProperty as the dependency property identifier.

If there is no explicit PlacementTarget, the placement target for a tooltip is the element that specifies a value for its ToolTipService.ToolTip attached property value. Any Placement value (either as an attached property or as an attribute on an explicit ToolTip element) applies to that target.

Tooltip content models

Generally there are four possible content models for tooltip content:

  • A text string as content of an implicit ToolTip.
  • An explicit ToolTip element, with text string content or no initial content (instead content is provided dynamically at run time).
  • An explicit ToolTip element, with further element content.
  • An object element as content of an implicit ToolTip.

For some scenarios it is adequate to use the default font presentation of text in a ToolTip, and it is this case that can specify the content as a string. However, this string is usually a string that should be handled as a resource, so that it can be localized to present locale-specific ToolTip text to the user.

If you want to change the default font presentation characteristics of ToolTip text, you can do any of the following:

  • Declare an explicit ToolTip element, and specify your own Template value for its presentation.
  • Declare an explicit ToolTip element, and set control-wide font attributes such as FontFamily and FontSize on that element.
  • Declare a text container object element such as TextBlock as the content. Set attributes of that element that change the font presentation, and set the content of the text container to the desired text.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls

Metadata

Windows.winmd

See also

ToolTipService
Attached properties overview

 

 

Show:
© 2014 Microsoft. All rights reserved.