Expand Minimize
This topic has not yet been rated - Rate this topic

UIElement3D.OnPreviewMouseRightButtonDown Method

Invoked when an unhandled PreviewMouseRightButtonDown routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.

Namespace:  System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)
protected internal virtual void OnPreviewMouseRightButtonDown(
	MouseButtonEventArgs e
)

Parameters

e
Type: System.Windows.Input.MouseButtonEventArgs

The MouseButtonEventArgs that contains the event data. The event data reports that the right mouse button was pressed.

The PreviewMouseRightButtonDown event appears to travel a tunneling route but actually travels in an indirect way. Mouse.PreviewMouseDown is the underlying event that is tunnel routed, and each UIElement3D along the event route uses identical handling to raise the direct routed event MouseRightButtonDown. Although you can mark the PreviewMouseRightButtonDown event as handled for purposes of this element, the handled state does not perpetuate to other elements along the event route. 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.

The default implementation for general mouse event handling in UIElement3D listens for Mouse.PreviewMouseDown and converts it to an appropriate local event. If you want to override this logic, you must create a derived class. In the static constructor of your derived class, register an alternative class handler for Mouse.PreviewMouseDown. You cannot change the mouse handling behavior of UIElement3D by overriding OnPreviewMouseRightButtonDown.

Alternatively, you can override this method in order to change event handling for a specific mouse state. Whether you choose to call the base implementation depends on your scenario. Failing to call base disables default input handling for that mouse event on ancestor classes that also expect to invoke OnPreviewMouseRightButtonDown. For example, you can derive from Control and override OnPreviewMouseRightButtonDown in your derived class without calling base; however, this override disables the context menu services on your control, which are part of the Control default behavior.

OnPreviewMouseRightButtonDown is introduced in the .NET Framework version 3.5. For more information, see .NET Framework Versions and Dependencies.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5 SP1, 3.0 SP1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.