Export (0) Print
Expand All

StylusDevice.GetStylusPoints Method (IInputElement, StylusPointDescription)

Returns a StylusPointCollection that contains StylusPoint objects collected from the stylus. Uses the specified StylusPointDescription.

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

public StylusPointCollection GetStylusPoints(
	IInputElement relativeTo,
	StylusPointDescription subsetToReformatTo
)

Parameters

relativeTo
Type: System.Windows.IInputElement

The IInputElement to which the (x y) coordinates in the StylusPointCollection are mapped.

subsetToReformatTo
Type: System.Windows.Input.StylusPointDescription

The StylusPointDescription to be used by the StylusPointCollection.

Return Value

Type: System.Windows.Input.StylusPointCollection
A StylusPointCollection that contains StylusPoint objects collected from the stylus.

ExceptionCondition
InvalidOperationException

relativeTo is neither UIElement or FrameworkContentElement.

subsetToReformatTo must be compatible with the Description property of the StylusPointCollection used by the GetStylusPoints(IInputElement) method. Use the GetCommonDescription method to get a StylusPointDescription before calling the GetStylusPoints(IInputElement, StylusPointDescription) method.

The following example demonstrates how to get StylusPoint objects from the current StylusDevice.

StylusDevice currentStylus = Stylus.CurrentStylusDevice;
StylusPointDescription description1 =
      new StylusPointDescription(new StylusPointPropertyInfo[]
                    {
                        new StylusPointPropertyInfo(StylusPointProperties.X),
                        new StylusPointPropertyInfo(StylusPointProperties.Y),
                        new StylusPointPropertyInfo(StylusPointProperties.NormalPressure),
                        new StylusPointPropertyInfo(StylusPointProperties.XTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.YTiltOrientation),
                        new StylusPointPropertyInfo(StylusPointProperties.BarrelButton)
                    });

StylusPointDescription description2 = currentStylus.GetStylusPoints(inkCanvas1).Description;

StylusPointDescription description3 = 
    StylusPointDescription.GetCommonDescription(description1, description2);

StylusPointCollection points = currentStylus.GetStylusPoints(inkCanvas1, description3);

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft