FrameworkElement.ToolTipOpening 事件


任何元素的工具提示開啟時發生。Occurs when any tooltip on the element is opened.

 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 中,您的處理常式 ToolTipOpening 可以將事件資料標示為已 ToolTipEventArgs 處理。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 nullToolTipOpening will not be raised if the value of ToolTip is null or otherwise unset. ToolTip null 當工具提示開啟或開啟時,不會刻意設定為,但這並不會影響關閉工具提示的效果,而會改為在 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.

ToolTipOpening事件不能是 EventTrigger 樣式中的。The ToolTipOpening event cannot be an EventTrigger in a style. 這是因為此事件的 [識別碼] 欄位會從不公開服務層級事件之新增/移除事件方法的服務中,重複使用執行。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.