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.
Assembly: System.Windows (in System.Windows.dll)
Property Value
Type: System.SingleThe pressure factor of the stylus on the screen. The default is 0.5.
| Exception | Condition |
|---|---|
| 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; } }