InkStroke InkStroke InkStroke InkStroke InkStroke Class


A single ink stroke, including the Bézier curve parameters used for final rendering of the stroke.

public : sealed class InkStroke : IInkStroke, IInkStroke2, IInkStroke3
struct winrt::Windows::UI::Input::Inking::InkStroke : IInkStroke, IInkStroke2, IInkStroke3
public sealed class InkStroke : IInkStroke, IInkStroke2, IInkStroke3
Public NotInheritable Class InkStroke Implements IInkStroke, IInkStroke2, IInkStroke3
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


Here we iterate through each stroke in an InkManager and process them for final rendering using Bézier curves.

// Iterate through each stroke.
    function (stroke)
        if (stroke.selected) {
            inkContext.lineWidth = stroke.drawingAttributes.size.width * 2;
            inkContext.strokeStyle = "green";
        } else {
            inkContext.lineWidth = stroke.drawingAttributes.size.width;
            inkContext.strokeStyle = "black";

        // Enumerate through each line segment of the stroke.
        var first = true;

            function (segment)
                // Move to the starting screen location of the stroke.
                if (first)
                    inkContext.moveTo(segment.position.x, segment.position.y);
                    first = false;
                // Calculate the bezier curve for the segment.
                                             segment.position.x, segment.position.y);
        // Draw the stroke.


JavaScript (usage)
var inkStrokes = Windows.UI.Input.Inking.InkManager.getStrokes; var inkStroke = inkStrokes[...];
var inkStrokes = Windows.UI.Input.Inking.inkRecognitionResult.getStrokes; var inkStroke = inkStrokes[...];
var inkStrokes = Windows.UI.Input.Inking.inkStrokeContainer.getStrokes; var inkStroke = inkStrokes[...];


: This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).


BoundingRect BoundingRect BoundingRect BoundingRect BoundingRect

Gets the bounding box for the InkStroke.

public : Rect BoundingRect { get; }
Rect BoundingRect();
public Rect BoundingRect { get; }
Public ReadOnly Property BoundingRect As Rect
var rect = inkStroke.boundingRect;
Rect Rect Rect

The bounding box.

See Also

DrawingAttributes DrawingAttributes DrawingAttributes DrawingAttributes DrawingAttributes

Gets or sets the properties associated with an InkStroke.

public : InkDrawingAttributes DrawingAttributes { get; set; }
InkDrawingAttributes DrawingAttributes(); void DrawingAttributes(InkDrawingAttributes drawingattributes);
public InkDrawingAttributes DrawingAttributes { get; set; }
Public ReadWrite Property DrawingAttributes As InkDrawingAttributes
var inkDrawingAttributes = inkStroke.drawingAttributes;
inkStroke.drawingAttributes = inkDrawingAttributes;


The following example demonstrates how to set a drawing attribute for a specific stroke.


You cannot set the DrawingAttributes property of the stroke directly. You must create a copy of the InkDrawingAttributes of the stroke, set the desired values for that InkDrawingAttributes object, and then assign the new InkDrawingAttributes to the DrawingAttributes of the stroke, as shown here.

inkManager.getStrokes().forEach(function (stroke)
  var drawingAttributes = stroke.drawingAttributes;
  drawingAttributes.penTip = 
  stroke.drawingAttributes = drawingAttributes;

// Get the InkStroke objects.
IReadOnlyList<InkStroke> inkStrokes = inkManager.GetStrokes();
Windows.UI.Input.Inking.InkStroke cloneStroke = 
Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes = 
drawingAttributes.PenTip = Windows.UI.Input.Inking.PenTipShape.Rectangle;
cloneStroke.DrawingAttributes = drawingAttributes;

For the complete example, see Ink App sample.

See Also

Id Id Id Id Id

Gets the the ink stroke identifier.

A unique identifier is assigned to each ink stroke managed by the InkPresenter.

public : unsigned int Id { get; }
uint32_t Id();
public uint Id { get; }
Public ReadOnly Property Id As uint
var uint =;
uint uint uint

The identifier for the ink stroke.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)


This identifier does not persist through serialization/deserialization of the ink stroke. After deserialization, a new identifer is assigned.

Calling the Clone method also generates a new identifier for the cloned stroke.

See Also

PointTransform PointTransform PointTransform PointTransform PointTransform

Gets or sets an affine transformation matrix to apply to the InkStroke object.

public : Matrix3x2 PointTransform { get; set; }
Matrix3x2 PointTransform(); void PointTransform(Matrix3x2 pointtransform);
public Matrix3x2 PointTransform { get; set; }
Public ReadWrite Property PointTransform As Matrix3x2
var matrix3x2 = inkStroke.pointTransform;
inkStroke.pointTransform = matrix3x2;
Matrix3x2 Matrix3x2 Matrix3x2

The 2-D transformation matrix.

See Also

Recognized Recognized Recognized Recognized Recognized

Gets whether the stroke is recognized.

public : Platform::Boolean Recognized { get; }
bool Recognized();
public bool Recognized { get; }
Public ReadOnly Property Recognized As bool
var bool = inkStroke.recognized;
bool bool bool

True if the stroke is recognized; otherwise, false.

See Also

Selected Selected Selected Selected Selected

Gets whether the stroke is selected.

public : Platform::Boolean Selected { get; set; }
bool Selected(); void Selected(bool selected);
public bool Selected { get; set; }
Public ReadWrite Property Selected As bool
var bool = inkStroke.selected;
inkStroke.selected = bool;
bool bool bool

True if the stroke is selected; otherwise, false.

See Also

StrokeDuration StrokeDuration StrokeDuration StrokeDuration StrokeDuration

Gets or sets the time taken by the user to draw a single ink stroke.

public : IReference<TimeSpan> StrokeDuration { get; set; }
IReference<TimeSpan> StrokeDuration(); void StrokeDuration(IReference<TimeSpan> strokeduration);
public Nullable<TimeSpan> StrokeDuration { get; set; }
Public ReadWrite Property StrokeDuration As Nullable<TimeSpan>
var nullable = inkStroke.strokeDuration;
inkStroke.strokeDuration = nullable;
Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>

The time period expressed in 100-nanosecond units.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

StrokeStartedTime StrokeStartedTime StrokeStartedTime StrokeStartedTime StrokeStartedTime

Gets or sets the date and time when the InkStroke was started.

public : IReference<DateTime> StrokeStartedTime { get; set; }
IReference<DateTime> StrokeStartedTime(); void StrokeStartedTime(IReference<DateTime> strokestartedtime);
public Nullable<DateTimeOffset> StrokeStartedTime { get; set; }
Public ReadWrite Property StrokeStartedTime As Nullable<DateTimeOffset>
var nullable = inkStroke.strokeStartedTime;
inkStroke.strokeStartedTime = nullable;
Nullable<DateTimeOffset> Nullable<DateTimeOffset> Nullable<DateTimeOffset>

The date and time of day.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)


Clone() Clone() Clone() Clone() Clone()

Copies the InkStroke to another InkManager (or InkStrokeContainer ).

public : InkStroke Clone()
InkStroke Clone() const;
public InkStroke Clone()
Public Function Clone() As InkStroke
var inkStroke = inkStroke.clone();


This method must be used with AddStroke (InkManager ) or AddStroke (InkStrokeContainer ).

See Also

GetInkPoints() GetInkPoints() GetInkPoints() GetInkPoints() GetInkPoints()

Gets the collection of InkPoint objects used to construct the InkStroke.

public : IVectorView<InkPoint> GetInkPoints()
IVectorView<InkPoint> GetInkPoints() const;
public IReadOnlyList<InkPoint> GetInkPoints()
Public Function GetInkPoints() As IReadOnlyList<InkPoint>( Of InkPoint )
var iVectorView = inkStroke.getInkPoints();
IReadOnlyList<InkPoint> IReadOnlyList<InkPoint> IReadOnlyList<InkPoint>

The collection of InkPoint objects used to construct the InkStroke.

See Also

GetRenderingSegments() GetRenderingSegments() GetRenderingSegments() GetRenderingSegments() GetRenderingSegments()

Gets the rendering segments of the stroke.


For Universal Windows app using Extensible Application Markup Language (XAML), use GetInkPoints (see remarks).

public : IVectorView<InkStrokeRenderingSegment> GetRenderingSegments()
IVectorView<InkStrokeRenderingSegment> GetRenderingSegments() const;
public IReadOnlyList<InkStrokeRenderingSegment> GetRenderingSegments()
Public Function GetRenderingSegments() As IReadOnlyList<InkStrokeRenderingSegment>( Of InkStrokeRenderingSegment )
var iVectorView = inkStroke.getRenderingSegments();
IReadOnlyList<InkStrokeRenderingSegment> IReadOnlyList<InkStrokeRenderingSegment> IReadOnlyList<InkStrokeRenderingSegment>

The collection of InkStrokeRenderingSegment objects.


If FitToCurve is set to true, this method returns an InkStrokeRenderingSegment that approximates the Bezier curve of the stroke.

If FitToCurve is set to false, this method returns a collection of InkStrokeRenderingSegment objects that represent the original raw pointer data as line segments.

For Universal Windows app using Extensible Application Markup Language (XAML), avoid changing the state of an ink stroke to retrieve the raw pointer data by using GetInkPoints instead.

See Also

See Also