UIElement.OnMouseRightButtonUp(MouseButtonEventArgs) Method


当某个未处理的 MouseRightButtonUp 路由事件在其路由中到达派生自此类的某个元素时调用。Invoked when an unhandled MouseRightButtonUp routed event reaches an element in its route that is derived from this class. 实现此方法可为此事件添加类处理。Implement this method to add class handling for this event.

 virtual void OnMouseRightButtonUp(System::Windows::Input::MouseButtonEventArgs ^ e);
protected virtual void OnMouseRightButtonUp (System.Windows.Input.MouseButtonEventArgs e);
abstract member OnMouseRightButtonUp : System.Windows.Input.MouseButtonEventArgs -> unit
override this.OnMouseRightButtonUp : System.Windows.Input.MouseButtonEventArgs -> unit
Protected Overridable Sub OnMouseRightButtonUp (e As MouseButtonEventArgs)



包含事件数据的 MouseButtonEventArgsThe MouseButtonEventArgs that contains the event data. 事件数据报告称已释放鼠标右键。The event data reports that the right mouse button was released.


MouseRightButtonUp 事件显示为以冒泡路线旅行,但实际以间接方式传播。The MouseRightButtonUp event appears to travel a bubbling route but actually travels in an indirect way. Mouse.MouseUp 是冒泡路由的基础事件,事件路由中的每个 UIElement 使用相同的处理来引发直接路由事件 MouseRightButtonUpMouse.MouseUp is the underlying event that is bubble routed, and each UIElement along the event route uses identical handling to raise the direct routed event MouseRightButtonUp. 虽然您可以将 MouseRightButtonUp 事件标记为为此元素的目的进行处理,但已处理状态并不会与事件路由中的其他元素保持。Although you can mark the MouseRightButtonUp event as handled for purposes of this element, the handled state does not perpetuate to other elements along the event route. 但是,你可能需要将事件标记为已处理,以防止调用常规实例处理程序(未指定 handledEventsToo)。However, you might want to mark the event as handled in order to prevent general instance handlers (those that did not specify handledEventsToo) from being invoked.

UIElement 中的常规鼠标事件处理的默认实现侦听 Mouse.MouseUp 并将其转换为适当的本地事件。The default implementation for general mouse event handling in UIElement listens for Mouse.MouseUp and converts it to an appropriate local event. 如果要重写此逻辑,必须创建派生类。If you want to override this logic, you must create a derived class. 在派生类的静态构造函数中,为 Mouse.MouseUp注册替代类处理程序。In the static constructor of your derived class, register an alternative class handler for Mouse.MouseUp. 不能通过重写 OnMouseRightButtonUp更改 UIElement 的鼠标处理行为。You cannot change the mouse handling behavior of UIElement by overriding OnMouseRightButtonUp.

Applies to