MouseDevice.GetPosition(IInputElement) Method

Definition

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

public:
 System::Windows::Point GetPosition(System::Windows::IInputElement ^ relativeTo);
[System.Security.SecurityCritical]
public System.Windows.Point GetPosition (System.Windows.IInputElement relativeTo);
public System.Windows.Point GetPosition (System.Windows.IInputElement relativeTo);
[<System.Security.SecurityCritical>]
member this.GetPosition : System.Windows.IInputElement -> System.Windows.Point
member this.GetPosition : System.Windows.IInputElement -> System.Windows.Point
Public Function GetPosition (relativeTo As IInputElement) As Point

Parameters

relativeTo
IInputElement

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

Returns

The position of the mouse relative to the parameter relativeTo.

Attributes

Exceptions

relativeTo is null or is not a UIElement or ContentElement.

Remarks

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.

Applies to