UIElement.PreviewMouseRightButtonDown UIElement.PreviewMouseRightButtonDown UIElement.PreviewMouseRightButtonDown UIElement.PreviewMouseRightButtonDown Event


滑鼠指標在此元素上方且按下滑鼠右按鈕時發生。Occurs when the right mouse button is pressed while the mouse pointer is over this element.

 virtual event System::Windows::Input::MouseButtonEventHandler ^ PreviewMouseRightButtonDown;
public event System.Windows.Input.MouseButtonEventHandler PreviewMouseRightButtonDown;
member this.PreviewMouseRightButtonDown : System.Windows.Input.MouseButtonEventHandler 
Public Custom Event PreviewMouseRightButtonDown As MouseButtonEventHandler 



雖然這路由的事件似乎會遵循通道路由項目樹狀結構中,它實際上是直接路由的事件的引發並由每個項目樹狀結構中沿著 reraised UIElementAlthough this routed event seems to follow a tunneling route through an element tree, it actually is a direct routed event that is raised and reraised along the element tree by each UIElement.

此事件會報告滑鼠按鈕的細節有基礎的多個相關事件的其中一個Mouse.PreviewMouseDown事件,這是附加的事件處理的事件路由的每個項目。This event is one of several related events that report the mouse-button specifics of an underlying Mouse.PreviewMouseDown event, which is an attached event that is processed by each element along an event route.

此事件的事件資料會公開事件資料的基礎Mouse.PreviewMouseDown事件。The event data of this event exposes the event data of the underlying Mouse.PreviewMouseDown event. 如果該事件標示為已處理此事件路由,仍然會引發滑鼠按鈕的特定事件;不過,必須新增的滑鼠按鈕的特定事件的處理常式藉由明確呼叫AddHandler,選項來處理已標示為已處理的事件、 事件接聽程式,才能使用。If that event is marked as handled along the event route, the mouse-button specific events are still raised; however, handlers of the mouse-button specific events must be added by explicitly calling AddHandler, with the option to handle events that are already marked as handled, in order to be listeners to the event. 如果您將標示PreviewMouseRightButtonDown處理,您基本上將標示Mouse.PreviewMouseDown處理路由中的所有進一步的接聽程式和所有相關事件。If you mark PreviewMouseRightButtonDown handled, you are essentially marking Mouse.PreviewMouseDown handled for all further listeners along the route, and on all related events. 這可能包含的類別處理常式產生事件這類PreviewMouseDoubleClickThis possibly includes class-handler generated events such as PreviewMouseDoubleClick.

就概念而言,將此事件 (和其他的滑鼠按鍵事件,對於UIElement) 是滑鼠 「 服務 」 (使用所提供的服務定義Mouse類別)。Conceptually, think of this event (and other mouse-button events on UIElement) to be a mouse "service" (with the service definition provided by the Mouse class). 事件會新增不需要檢查原始的滑鼠事件,事件資料中的滑鼠按鈕狀態 (左右,上下按鈕控制項) 的便利性。The event adds the convenience of not needing to check the mouse button states (left-right, up-down) of the original mouse events in the event data. 針對更進階的案例,例如檢查狀態的標準按鈕,您可能需要使用APIAPIsMouse類別,而這些非上UIElementFor more advanced scenarios, such as checking for states of non-standard buttons, you might need to use the APIAPIs on the Mouse class rather than those on UIElement.

路由事件資訊Routed Event Information

識別項欄位Identifier field PreviewMouseRightButtonDownEvent
路由策略Routing strategy 直接Direct
Delegate - 委派Delegate MouseButtonEventHandler