共用方式為


GestureEventArgs.GetPosition Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns the x- and y-coordinates of the pointer position, optionally evaluated against a coordinate origin of a supplied T:System.Windows.UIElement .

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

Syntax

'Declaration
Public Function GetPosition ( _
    relativeTo As UIElement _
) As Point
public Point GetPosition(
    UIElement relativeTo
)

Parameters

  • relativeTo
    Type: System.Windows.UIElement
    Any UIElement-derived object that is contained by the Silverlight plug-in and connected to the object tree. To specify the object relative to the overall Silverlight coordinate system, pass null.

Return Value

Type: System.Windows.Point
A Point that represents the current x- and y-coordinates of the mouse pointer position. If null was passed as relativeTo, this coordinate is for the overall Silverlight plug-in content area. If a non-null relativeTo was passed, this coordinate is relative to the object referenced by relativeTo.

Remarks

Version Notes

Silverlight for the desktop

Do not use for a Silverlight for the desktop application.

Silverlight for Windows Phone Silverlight for Windows Phone

For information on using manipulations on Silverlight for Windows Phone, see How to: Handle Manipulation Events.

Version Information

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.