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.

Inheritance Hierarchy

System..::.Object
System..::.EventArgs
System.Windows..::.RoutedEventArgs
System.Windows.Input..::.MouseEventArgs
System.Windows.Input..::.MouseButtonEventArgs
System.Windows.Input..::.MouseWheelEventArgs

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

Syntax

Public Class MouseEventArgs _
    Inherits RoutedEventArgs
public class MouseEventArgs : RoutedEventArgs

The MouseEventArgs type exposes the following members.

Properties

Name Description
OriginalSource Gets a reference to the object that raised the event. (Inherited from RoutedEventArgs.)
StylusDevice Gets an object that reports stylus device information, such as the collection of stylus points associated with the input.

Top

Methods

Name Description
Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
GetPosition Returns the x- and y-coordinates of the pointer position, optionally evaluated against a coordinate origin of a supplied UIElement.
GetType Gets the Type of the current instance. (Inherited from Object.)
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

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.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

Thread Safety

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

See Also

Reference

System.Windows.Input Namespace

MouseEventHandler

Other Resources

Quickstart: Touch input for Windows Phone 8