MouseEventArgs Class

MouseEventArgs Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Provides data for pointer-related events that do not specifically involve device buttons, for example UIElement.MouseMove which includes Windows Phone pointer movement.

Namespace:  System.Windows.Input
Assembly:  System.Windows (in System.Windows.dll)

public class MouseEventArgs : RoutedEventArgs

The MouseEventArgs type exposes the following members.

Public propertyOriginalSourceGets a reference to the object that raised the event. (Inherited from RoutedEventArgs.)
Public propertyStylusDeviceGets an object that reports stylus device information, such as the collection of stylus points associated with the input.

Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetPositionReturns the x- and y-coordinates of the pointer position, optionally evaluated against a coordinate origin of a supplied UIElement.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

This event data class is used with the following events.

Note that events that specifically deal with mouse button events use a different event data class, MouseButtonEventArgs. You can use the shared API (MouseEventArgs.GetPosition or MouseEventArgs.StylusDevice) for any pointer event through event handling and the event data.

The most relevant member of MouseEventArgs is GetPosition, which is a method, not a property. Particularly for a click event, or for cases where the pointer is captured, it is often useful to know the exact pointer position at time of the event. GetPosition returns that position relative to the Windows Phone coordinate space, or optionally against the specific coordinate space of a supplied reference element.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

© 2017 Microsoft