MouseEventArgs.GetPosition Method (IInputElement)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns the position of the mouse pointer relative to the specified element.

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

public Point GetPosition(
	IInputElement relativeTo


Type: System.Windows.IInputElement

The element to use as the frame of reference for calculating the position of the mouse pointer.

Return Value

Type: System.Windows.Point

The x- and y-coordinates of the mouse pointer position relative to the specified object.

The point (0,0) is the upper-left corner of the frame of reference.

The static Mouse.GetPosition method can also be used to obtain the position of the mouse.

.NET Framework
Available since 3.0
Return to top