ToolTipService Class
TOC
Collapse the table of content
Expand the table of content

ToolTipService Class

 

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

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

System.Object
  System.Windows.Controls.ToolTipService

public static class ToolTipService

NameDescription
System_CAPS_pubpropertySystem_CAPS_staticBetweenShowDelay

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

System_CAPS_pubpropertySystem_CAPS_staticHasDropShadow

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

System_CAPS_pubpropertySystem_CAPS_staticHorizontalOffset

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

System_CAPS_pubpropertySystem_CAPS_staticInitialShowDelay

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

System_CAPS_pubpropertySystem_CAPS_staticIsEnabled

Gets or sets whether a tooltip appears.

System_CAPS_pubpropertySystem_CAPS_staticIsOpen

Gets whether a tooltip is currently visible.

System_CAPS_pubpropertySystem_CAPS_staticPlacement

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

System_CAPS_pubpropertySystem_CAPS_staticPlacementRectangle

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

System_CAPS_pubpropertySystem_CAPS_staticPlacementTarget

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

System_CAPS_pubpropertySystem_CAPS_staticShowDuration

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

System_CAPS_pubpropertySystem_CAPS_staticShowOnDisabled

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

System_CAPS_pubpropertySystem_CAPS_staticToolTip

Gets or sets the content of a tooltip.

System_CAPS_pubpropertySystem_CAPS_staticVerticalOffset

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAddToolTipClosingHandler(DependencyObject, ToolTipEventHandler)

Adds a handler for the ToolTipClosing attached event.

System_CAPS_pubmethodSystem_CAPS_staticAddToolTipOpeningHandler(DependencyObject, ToolTipEventHandler)

Adds a handler for the ToolTipOpening attached event.

System_CAPS_pubmethodSystem_CAPS_staticGetBetweenShowDelay(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetHasDropShadow(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetHorizontalOffset(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetInitialShowDelay(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetIsEnabled(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetIsOpen(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetPlacement(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetPlacementRectangle(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetPlacementTarget(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetShowDuration(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetShowOnDisabled(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetToolTip(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticGetVerticalOffset(DependencyObject)

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

System_CAPS_pubmethodSystem_CAPS_staticRemoveToolTipClosingHandler(DependencyObject, ToolTipEventHandler)

Removes a handler for the ToolTipClosing attached event.

System_CAPS_pubmethodSystem_CAPS_staticRemoveToolTipOpeningHandler(DependencyObject, ToolTipEventHandler)

Removes a handler for the ToolTipOpening attached event.

System_CAPS_pubmethodSystem_CAPS_staticSetBetweenShowDelay(DependencyObject, Int32)

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

System_CAPS_pubmethodSystem_CAPS_staticSetHasDropShadow(DependencyObject, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticSetHorizontalOffset(DependencyObject, Double)

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

System_CAPS_pubmethodSystem_CAPS_staticSetInitialShowDelay(DependencyObject, Int32)

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

System_CAPS_pubmethodSystem_CAPS_staticSetIsEnabled(DependencyObject, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticSetPlacement(DependencyObject, PlacementMode)

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

System_CAPS_pubmethodSystem_CAPS_staticSetPlacementRectangle(DependencyObject, Rect)

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

System_CAPS_pubmethodSystem_CAPS_staticSetPlacementTarget(DependencyObject, UIElement)

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

System_CAPS_pubmethodSystem_CAPS_staticSetShowDuration(DependencyObject, Int32)

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

System_CAPS_pubmethodSystem_CAPS_staticSetShowOnDisabled(DependencyObject, Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticSetToolTip(DependencyObject, Object)

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

System_CAPS_pubmethodSystem_CAPS_staticSetVerticalOffset(DependencyObject, Double)

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

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticBetweenShowDelayProperty

Identifies the BetweenShowDelay attached property.

System_CAPS_pubfieldSystem_CAPS_staticHasDropShadowProperty

Identifies the HasDropShadow attached property.

System_CAPS_pubfieldSystem_CAPS_staticHorizontalOffsetProperty

Identifies the HorizontalOffset attached property.

System_CAPS_pubfieldSystem_CAPS_staticInitialShowDelayProperty

Identifies the InitialShowDelay attached property.

System_CAPS_pubfieldSystem_CAPS_staticIsEnabledProperty

Identifies the IsEnabled attached property.

System_CAPS_pubfieldSystem_CAPS_staticIsOpenProperty

Identifies the IsOpen attached property.

System_CAPS_pubfieldSystem_CAPS_staticPlacementProperty

Identifies the Placement attached property.

System_CAPS_pubfieldSystem_CAPS_staticPlacementRectangleProperty

Identifies the PlacementRectangle attached property.

System_CAPS_pubfieldSystem_CAPS_staticPlacementTargetProperty

Identifies the PlacementTarget attached property.

System_CAPS_pubfieldSystem_CAPS_staticShowDurationProperty

Identifies the ShowDuration attached property.

System_CAPS_pubfieldSystem_CAPS_staticShowOnDisabledProperty

Identifies the ShowOnDisabled attached property.

System_CAPS_pubfieldSystem_CAPS_staticToolTipClosingEvent

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

System_CAPS_pubfieldSystem_CAPS_staticToolTipOpeningEvent

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

System_CAPS_pubfieldSystem_CAPS_staticToolTipProperty

Identifies the ToolTip attached property.

System_CAPS_pubfieldSystem_CAPS_staticVerticalOffsetProperty

Identifies the VerticalOffset attached property.

NameDescription
System_CAPS_pubeventSystem_CAPS_staticToolTipClosing

Occurs when the ToolTip closes.

System_CAPS_pubeventSystem_CAPS_staticToolTipOpening

Occurs when the ToolTip opens.

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. The ToolTipService class attached properties 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.

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>

.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft