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


任何元素的工具提示開啟時發生。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 若將不會產生值ToolTipnull或其他未設定。ToolTipOpening will not be raised if the value of ToolTip is null or otherwise unset. 不要刻意設定ToolTipnulltooltip 為開啟,或開啟; 這不會關閉工具提示的影響,會改為建立在 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 - 委派Delegate ToolTipEventHandler
  • 覆寫OnToolTipClosing實作在衍生類別中這個事件的類別處理。Override OnToolTipClosing to implement class handling for this event in derived classes.