StylusPoint.X Property

Gets or sets the value for the x-coordinate of the StylusPoint.

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

Syntax

'Declaration
Public Property X As Double
public double X { get; set; }
<StylusPoint X="double"/>

Property Value

Type: System.Double
The x-coordinate of the StylusPoint in a pixel grid. The default is 0.

Exceptions

Exception Condition
ArgumentOutOfRangeException

X is set a value that evaluates to infinity or a value that is not a number.

Examples

The following code example demonstrates how to get the member X property. This is part of a larger example available in StylusPoint class overview.

    'StylusPoint objects are collected from the MouseEventArgs and added to MyStroke
    Private Sub MyIP_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
        If (Not (MyStroke) Is Nothing) Then
            MyStroke.StylusPoints.Add(e.StylusDevice.GetStylusPoints(MyIP))
            XTB.Text = ("" + e.StylusDevice.GetStylusPoints(MyIP)(0).X)
            YTB.Text = ("" + e.StylusDevice.GetStylusPoints(MyIP)(0).Y)
            PressureTB.Text = ("" + e.StylusDevice.GetStylusPoints(MyIP)(0).PressureFactor)
        End If
    End Sub

//StylusPoint objects are collected from the MouseEventArgs and added to MyStroke
private void MyIP_MouseMove(object sender, MouseEventArgs e)
{
    if (MyStroke != null)
    {
        MyStroke.StylusPoints.Add(e.StylusDevice.GetStylusPoints(MyIP));
        XTB.Text = "" + e.StylusDevice.GetStylusPoints(MyIP)[0].X;
        YTB.Text = "" + e.StylusDevice.GetStylusPoints(MyIP)[0].Y;
        PressureTB.Text = "" + e.StylusDevice.GetStylusPoints(MyIP)[0].PressureFactor;
    }
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

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