Microsoft Silverlight will reach end of support after October 2021. Learn more.
Provides data for mouse-related events that do not specifically involve mouse buttons, for example UIElement.MouseMove.
Assembly: System.Windows (in System.Windows.dll)
'Declaration Public Class MouseEventArgs _ Inherits RoutedEventArgs
public class MouseEventArgs : RoutedEventArgs
The MouseEventArgs type exposes the following members.
|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.|
|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 mouse 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.)|
This event data class is used with the following mouse events.
Note that events that specifically deal with mouse button events use a different event data class, MouseButtonEventArgs. Events that deal with the mouse wheel use MouseWheelEventArgs. MouseButtonEventArgs and MouseWheelEventArgs both derive from MouseEventArgs. Therefore, you can use the shared API (MouseEventArgs.GetPosition or MouseEventArgs.StylusDevice) for any Silverlight mouse event through event handling and the event data.
In the WPF implementation of MouseEventArgs, you could check properties to determine mouse button state even if the event was not a button-related event, and also could query for the underlying device. Neither of these features are supported in the Silverlight 5 implementation of MouseEventArgs.
The most relevant member of MouseEventArgs is GetPosition, which is a method, not a property. Particularly for a mouse button event, or for cases where the mouse is captured, it is often useful to know the exact mouse pointer position at time of the event. GetPosition returns that position relative to the Silverlight coordinate space, or optionally against the specific coordinate space of a supplied reference element.
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.