MouseDevice.GetPosition Method (IInputElement)


Gets the position of the mouse relative to a specified element.

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

public Point GetPosition(
	IInputElement relativeTo


Type: System.Windows.IInputElement

The frame of reference in which to calculate the position of the mouse.

Return Value

Type: System.Windows.Point

The position of the mouse relative to the parameter relativeTo.

Exception Condition

relativeTo is null or is not a UIElement or ContentElement.

The position of the mouse pointer is calculated relative to the specified IInputElement with the upper-left corner of element being the point of origin, 0,0.

.NET Framework
Available since 3.0
Return to top