PressureFactor Property
Collapse the table of content
Expand the table of content

StylusPoint.PressureFactor Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets the pressure factor of the stylus on the screen.

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

public float PressureFactor { get; set; }

Property Value

Type: System.Single
The pressure factor of the stylus on the screen. The default is 0.5.

ExceptionCondition
ArgumentOutOfRangeException

PressureFactoris set to a value that is less than 0 or greater than 1.0.

The permitted range is 0 to 1.0. Values obtained from input will always be within this range. Setting the value to outside this range causes an exception to be thrown.

The value is a factor of the total possible pressure.

The typical scenario for this property is to modify the DrawingAttributes based on the PressureFactor captured in a StylusPoint obtained from user input. Notice that while PressureFactor comes from individual points, DrawingAttributes must apply to an entire Stroke.

XAML Attribute Usage

<StylusPoint PressureFactor="double"/>

The following code example demonstrates how to get the member Y 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 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;
    }
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft