ToolTipService ToolTipService ToolTipService ToolTipService Class

Definition

Represents a service that provides properties and events to control the display and behavior of tooltips.

public ref class ToolTipService abstract sealed
public static class ToolTipService
type ToolTipService = class
Public Class ToolTipService
Inheritance
ToolTipServiceToolTipServiceToolTipServiceToolTipService

Examples

The following example shows how the use the ToolTipService class to specify the behavior of a tooltip. You set the properties of the ToolTipService class by attaching them directly to the element that exposes the tooltip.

<Ellipse Height="25" Width="50" 
      Fill="Gray" 
      HorizontalAlignment="Left"
      ToolTipService.InitialShowDelay="1000"
      ToolTipService.ShowDuration="7000"
      ToolTipService.BetweenShowDelay="2000"
      ToolTipService.Placement="Right" 
      ToolTipService.PlacementRectangle="50,0,0,0"
      ToolTipService.HorizontalOffset="10" 
      ToolTipService.VerticalOffset="20"
      ToolTipService.HasDropShadow="false"
      ToolTipService.ShowOnDisabled="true" 
      ToolTipService.IsEnabled="true"
      ToolTipOpening="whenToolTipOpens"
      ToolTipClosing="whenToolTipCloses"
      >
  <Ellipse.ToolTip>
    <BulletDecorator>
      <BulletDecorator.Bullet>
        <Ellipse Height="10" Width="20" Fill="Blue"/>
      </BulletDecorator.Bullet>
      <TextBlock>Uses the ToolTipService class</TextBlock>
    </BulletDecorator>
  </Ellipse.ToolTip>
</Ellipse>

Remarks

You define a tooltip for an element by setting the FrameworkContentElement.ToolTip or FrameworkElement.ToolTip property. The ToolTip property takes one child. The content of the child can vary from a simple text string to more complex content such as a StackPanel that has embedded text and Image elements.

You can define tooltip content as a ToolTip object, but this is not required. When you do not define the tooltip content as a ToolTip object, you can use the ToolTipService properties to position and customize the tooltip content. Attached properties of the ToolTipService class are used to determine the placement, behavior, and appearance of a tooltip. These properties are set on the element that defines the tooltip.

The ToolTip class and the ToolTipService class share many of the same properties that are used to customize a tooltip. If equivalent ToolTip and ToolTipService properties are both set, the ToolTipService property takes precedence. For example, if both the ToolTip.Placement property and the ToolTipService.Placement property are set for a System.Windows.Controls.ToolTip object, the value of the ToolTipService.Placement property is used.

The following ToolTipService timing properties are only defined for the ToolTipService class and are used by all tooltips:

For information about how to handle the events that occur when the tooltip opens or closes, see the ToolTipOpeningEvent and ToolTipClosingEvent fields.

Placement, PlacementRectangle, PlacementTarget, HorizontalOffset, and VerticalOffset behave similarly to the properties of the same name in the Popup class. For more information, see Popup Placement Behavior.

Fields

BetweenShowDelayProperty BetweenShowDelayProperty BetweenShowDelayProperty BetweenShowDelayProperty

Identifies the ToolTipService.BetweenShowDelay attached property.

HasDropShadowProperty HasDropShadowProperty HasDropShadowProperty HasDropShadowProperty

Identifies the ToolTipService.HasDropShadow attached property.

HorizontalOffsetProperty HorizontalOffsetProperty HorizontalOffsetProperty HorizontalOffsetProperty

Identifies the ToolTipService.HorizontalOffset attached property.

InitialShowDelayProperty InitialShowDelayProperty InitialShowDelayProperty InitialShowDelayProperty

Identifies the ToolTipService.InitialShowDelay attached property.

IsEnabledProperty IsEnabledProperty IsEnabledProperty IsEnabledProperty

Identifies the ToolTipService.IsEnabled attached property.

IsOpenProperty IsOpenProperty IsOpenProperty IsOpenProperty

Identifies the ToolTipService.IsOpen attached property.

PlacementProperty PlacementProperty PlacementProperty PlacementProperty

Identifies the ToolTipService.Placement attached property.

PlacementRectangleProperty PlacementRectangleProperty PlacementRectangleProperty PlacementRectangleProperty

Identifies the ToolTipService.PlacementRectangle attached property.

PlacementTargetProperty PlacementTargetProperty PlacementTargetProperty PlacementTargetProperty

Identifies the ToolTipService.PlacementTarget attached property.

ShowDurationProperty ShowDurationProperty ShowDurationProperty ShowDurationProperty

Identifies the ToolTipService.ShowDuration attached property.

ShowOnDisabledProperty ShowOnDisabledProperty ShowOnDisabledProperty ShowOnDisabledProperty

Identifies the ShowOnDisabled attached property.

ToolTipClosingEvent ToolTipClosingEvent ToolTipClosingEvent ToolTipClosingEvent

Identifies the ToolTipClosing event that is exposed by objects that use the ToolTipService service to display tooltips.

ToolTipOpeningEvent ToolTipOpeningEvent ToolTipOpeningEvent ToolTipOpeningEvent

Identifies the ToolTipOpening event that is exposed by objects that use the ToolTipService service to display tooltips.

ToolTipProperty ToolTipProperty ToolTipProperty ToolTipProperty

Identifies the ToolTipService.ToolTip attached property.

VerticalOffsetProperty VerticalOffsetProperty VerticalOffsetProperty VerticalOffsetProperty

Identifies the ToolTipService.VerticalOffset attached property.

Attached Properties

BetweenShowDelay BetweenShowDelay BetweenShowDelay BetweenShowDelay

Gets or sets the maximum time between the display of two tooltips where the second tooltip appears without a delay.

HasDropShadow HasDropShadow HasDropShadow HasDropShadow

Gets or sets whether the tooltip displays a drop shadow effect.

HorizontalOffset HorizontalOffset HorizontalOffset HorizontalOffset

Gets or sets the offset from the left of the area that is specified for the tooltip by the PlacementRectangle and PlacementTarget properties.

InitialShowDelay InitialShowDelay InitialShowDelay InitialShowDelay

Gets or sets the length of time before a tooltip opens.

IsEnabled IsEnabled IsEnabled IsEnabled

Gets or sets whether a tooltip appears.

IsOpen IsOpen IsOpen IsOpen
Placement Placement Placement Placement

Gets or sets the orientation of the tooltip when it opens, and specifies how the tooltip behaves when it overlaps screen boundaries.

PlacementRectangle PlacementRectangle PlacementRectangle PlacementRectangle

Gets or sets the rectangular area relative to which the tooltip is positioned.

PlacementTarget PlacementTarget PlacementTarget PlacementTarget

Gets or sets the object relative to which the tooltip is positioned.

ShowDuration ShowDuration ShowDuration ShowDuration

Gets or sets the amount of time that a tooltip remains visible.

ShowOnDisabled ShowOnDisabled ShowOnDisabled ShowOnDisabled

Gets or sets whether a tooltip appears for an object that is not enabled.

ToolTip ToolTip ToolTip ToolTip

Gets or sets the content of a tooltip.

VerticalOffset VerticalOffset VerticalOffset VerticalOffset

Gets or sets the distance from the top of the area that is specified for the tooltip by the PlacementRectangle and PlacementTarget properties.

Methods

AddToolTipClosingHandler(DependencyObject, ToolTipEventHandler) AddToolTipClosingHandler(DependencyObject, ToolTipEventHandler) AddToolTipClosingHandler(DependencyObject, ToolTipEventHandler) AddToolTipClosingHandler(DependencyObject, ToolTipEventHandler)

Adds a handler for the ToolTipService.ToolTipClosing attached event.

AddToolTipOpeningHandler(DependencyObject, ToolTipEventHandler) AddToolTipOpeningHandler(DependencyObject, ToolTipEventHandler) AddToolTipOpeningHandler(DependencyObject, ToolTipEventHandler) AddToolTipOpeningHandler(DependencyObject, ToolTipEventHandler)

Adds a handler for the ToolTipService.ToolTipOpening attached event.

GetBetweenShowDelay(DependencyObject) GetBetweenShowDelay(DependencyObject) GetBetweenShowDelay(DependencyObject) GetBetweenShowDelay(DependencyObject)

Gets the value of the ToolTipService.BetweenShowDelay attached property for an object.

GetHasDropShadow(DependencyObject) GetHasDropShadow(DependencyObject) GetHasDropShadow(DependencyObject) GetHasDropShadow(DependencyObject)

Gets the value of the ToolTipService.HasDropShadow attached property for an object.

GetHorizontalOffset(DependencyObject) GetHorizontalOffset(DependencyObject) GetHorizontalOffset(DependencyObject) GetHorizontalOffset(DependencyObject)

Gets the value of the ToolTipService.HorizontalOffset attached property for an object.

GetInitialShowDelay(DependencyObject) GetInitialShowDelay(DependencyObject) GetInitialShowDelay(DependencyObject) GetInitialShowDelay(DependencyObject)

Gets the value of the ToolTipService.InitialShowDelay attached property for an object.

GetIsEnabled(DependencyObject) GetIsEnabled(DependencyObject) GetIsEnabled(DependencyObject) GetIsEnabled(DependencyObject)

Gets the value of the ToolTipService.IsEnabled attached property for an object.

GetIsOpen(DependencyObject) GetIsOpen(DependencyObject) GetIsOpen(DependencyObject) GetIsOpen(DependencyObject)

Gets the value of the ToolTipService.IsOpen attached property for an object.

GetPlacement(DependencyObject) GetPlacement(DependencyObject) GetPlacement(DependencyObject) GetPlacement(DependencyObject)

Gets the value of the ToolTipService.Placement attached property for an object.

GetPlacementRectangle(DependencyObject) GetPlacementRectangle(DependencyObject) GetPlacementRectangle(DependencyObject) GetPlacementRectangle(DependencyObject)

Gets the value of the ToolTipService.PlacementRectangle attached property for an object.

GetPlacementTarget(DependencyObject) GetPlacementTarget(DependencyObject) GetPlacementTarget(DependencyObject) GetPlacementTarget(DependencyObject)

Gets the value of the ToolTipService.PlacementTarget attached property for an object.

GetShowDuration(DependencyObject) GetShowDuration(DependencyObject) GetShowDuration(DependencyObject) GetShowDuration(DependencyObject)

Gets the value of the ToolTipService.ShowDuration attached property for an object.

GetShowOnDisabled(DependencyObject) GetShowOnDisabled(DependencyObject) GetShowOnDisabled(DependencyObject) GetShowOnDisabled(DependencyObject)

Gets the value of the ToolTipService.ShowOnDisabled attached property for an object.

GetToolTip(DependencyObject) GetToolTip(DependencyObject) GetToolTip(DependencyObject) GetToolTip(DependencyObject)

Gets the value of the ToolTipService.ToolTip attached property for an object.

GetVerticalOffset(DependencyObject) GetVerticalOffset(DependencyObject) GetVerticalOffset(DependencyObject) GetVerticalOffset(DependencyObject)

Gets the value of the ToolTipService.VerticalOffset attached property for an object.

RemoveToolTipClosingHandler(DependencyObject, ToolTipEventHandler) RemoveToolTipClosingHandler(DependencyObject, ToolTipEventHandler) RemoveToolTipClosingHandler(DependencyObject, ToolTipEventHandler) RemoveToolTipClosingHandler(DependencyObject, ToolTipEventHandler)

Removes a handler for the ToolTipService.ToolTipClosing attached event.

RemoveToolTipOpeningHandler(DependencyObject, ToolTipEventHandler) RemoveToolTipOpeningHandler(DependencyObject, ToolTipEventHandler) RemoveToolTipOpeningHandler(DependencyObject, ToolTipEventHandler) RemoveToolTipOpeningHandler(DependencyObject, ToolTipEventHandler)

Removes a handler for the ToolTipService.ToolTipOpening attached event.

SetBetweenShowDelay(DependencyObject, Int32) SetBetweenShowDelay(DependencyObject, Int32) SetBetweenShowDelay(DependencyObject, Int32) SetBetweenShowDelay(DependencyObject, Int32)

Sets the value of the ToolTipService.BetweenShowDelay attached property for an object.

SetHasDropShadow(DependencyObject, Boolean) SetHasDropShadow(DependencyObject, Boolean) SetHasDropShadow(DependencyObject, Boolean) SetHasDropShadow(DependencyObject, Boolean)

Sets the value of the HasDropShadow attached property for an object.

SetHorizontalOffset(DependencyObject, Double) SetHorizontalOffset(DependencyObject, Double) SetHorizontalOffset(DependencyObject, Double) SetHorizontalOffset(DependencyObject, Double)

Sets the value of the HorizontalOffset attached property for an object.

SetInitialShowDelay(DependencyObject, Int32) SetInitialShowDelay(DependencyObject, Int32) SetInitialShowDelay(DependencyObject, Int32) SetInitialShowDelay(DependencyObject, Int32)

Sets the value of the InitialShowDelay attached property for an object.

SetIsEnabled(DependencyObject, Boolean) SetIsEnabled(DependencyObject, Boolean) SetIsEnabled(DependencyObject, Boolean) SetIsEnabled(DependencyObject, Boolean)

Sets the value of the IsEnabled attached property for an object.

SetPlacement(DependencyObject, PlacementMode) SetPlacement(DependencyObject, PlacementMode) SetPlacement(DependencyObject, PlacementMode) SetPlacement(DependencyObject, PlacementMode)

Sets the value of the Placement attached property for an object.

SetPlacementRectangle(DependencyObject, Rect) SetPlacementRectangle(DependencyObject, Rect) SetPlacementRectangle(DependencyObject, Rect) SetPlacementRectangle(DependencyObject, Rect)

Sets the value of the PlacementRectangle attached property for an object.

SetPlacementTarget(DependencyObject, UIElement) SetPlacementTarget(DependencyObject, UIElement) SetPlacementTarget(DependencyObject, UIElement) SetPlacementTarget(DependencyObject, UIElement)

Sets the value of the PlacementTarget attached property for an object.

SetShowDuration(DependencyObject, Int32) SetShowDuration(DependencyObject, Int32) SetShowDuration(DependencyObject, Int32) SetShowDuration(DependencyObject, Int32)

Sets the value of the ShowDuration attached property for an object.

SetShowOnDisabled(DependencyObject, Boolean) SetShowOnDisabled(DependencyObject, Boolean) SetShowOnDisabled(DependencyObject, Boolean) SetShowOnDisabled(DependencyObject, Boolean)

Sets the value of the ShowOnDisabled attached property for an object.

SetToolTip(DependencyObject, Object) SetToolTip(DependencyObject, Object) SetToolTip(DependencyObject, Object) SetToolTip(DependencyObject, Object)

Sets the value of the ToolTip attached property for an object.

SetVerticalOffset(DependencyObject, Double) SetVerticalOffset(DependencyObject, Double) SetVerticalOffset(DependencyObject, Double) SetVerticalOffset(DependencyObject, Double)

Sets the value of the ToolTipService.VerticalOffset attached property for an object.

Attached Events

ToolTipClosing ToolTipClosing ToolTipClosing ToolTipClosing

Occurs when the ToolTip closes.

ToolTipOpening ToolTipOpening ToolTipOpening ToolTipOpening

Occurs when the ToolTip opens.

Applies to

See Also