FrameworkElement.ToolTipOpening FrameworkElement.ToolTipOpening FrameworkElement.ToolTipOpening FrameworkElement.ToolTipOpening Event

定义

在元素上的任何工具提示打开时发生。Occurs when any tooltip on the element is opened.

public:
 event System::Windows::Controls::ToolTipEventHandler ^ ToolTipOpening;
public event System.Windows.Controls.ToolTipEventHandler ToolTipOpening;
member this.ToolTipOpening : System.Windows.Controls.ToolTipEventHandler 
Public Custom Event ToolTipOpening As ToolTipEventHandler 

注解

为了防止工具提示在 UI 中显示, 的处理程序可以ToolTipOpeningToolTipEventArgs事件数据标记为已处理。To prevent a tooltip from appearing in the UI, your handler for ToolTipOpening can mark the ToolTipEventArgs event data handled. 否则, 将显示工具提示, 并使用ToolTip属性的值作为工具提示内容。Otherwise, the tooltip is displayed, using the value of the ToolTip property as the tooltip content. 另一种可能的情况是, 您可以编写一个处理程序, 用于ToolTip在显示工具提示之前重置作为事件源的元素的属性的值。Another possible scenario is that you could write a handler that resets the value of the ToolTip property for the element that is the event source, just before the tooltip is displayed.

ToolTipOpening如果的值ToolTip为或未设置, null则不会引发。ToolTipOpening will not be raised if the value of ToolTip is null or otherwise unset. 在工具提示打开ToolTipnull打开时, 不要特意设置为; 这将不会影响关闭工具提示, 而是在 UI 中创建不需要的视觉对象。Do not deliberately set ToolTip to null while a tooltip is open or opening; this will not have the effect of closing the tooltip, and will instead create an undesirable visual artifact in the UI.

事件不能是样式EventTrigger中的。 ToolTipOpeningThe ToolTipOpening event cannot be an EventTrigger in a style. 这是因为此事件的 "标识符" 字段会重新使用服务中的实现, 该实现不会公开服务级别事件的 add/remove 事件方法。This is because the identifier field of this event re-uses an implementation from a service that does not expose add/remove event methods for the service-level event.

路由事件信息Routed Event Information

标识符字段Identifier field ToolTipOpeningEvent
路由策略Routing strategy 直接Direct
委托Delegate ToolTipEventHandler
  • OnToolTipClosing写以在派生类中实现此事件的类处理。Override OnToolTipClosing to implement class handling for this event in derived classes.

适用于

另请参阅