Ink​Stroke​Container Ink​Stroke​Container Ink​Stroke​Container Class

Definition

Provides properties and methods to store and manage the collection of InkStroke objects rendered by the InkPresenter.

Modifications made to any of the ink strokes in the stroke container are immediately rendered to the drawing surface associated with the InkPresenter.

public : sealed class InkStrokeContainer : IInkStrokeContainer, IInkStrokeContainer2, IInkStrokeContainer3public sealed class InkStrokeContainer : IInkStrokeContainer, IInkStrokeContainer2, IInkStrokeContainer3Public NotInheritable Class InkStrokeContainer Implements IInkStrokeContainer, IInkStrokeContainer2, IInkStrokeContainer3
Attributes
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)

Remarks

For ink recognition, use an InkRecognizerContainer object.

The StrokesCollected event is fired when ink strokes are processed ("wet" to "dry") on the UI thread.

Note

: 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).

Constructors

InkStrokeContainer() InkStrokeContainer() InkStrokeContainer()

Creates a new InkStrokeContainer object that is used to manage InkStroke objects.

public : InkStrokeContainer()public InkStrokeContainer()Public Sub New()
Attributes
See Also

Properties

BoundingRect BoundingRect BoundingRect

Gets the bounding rectangle of the InkStroke collection managed by the InkStrokeContainer.

public : Rect BoundingRect { get; }public Rect BoundingRect { get; }Public ReadOnly Property BoundingRect As Rect
Value
Rect Rect Rect

The bounding rectangle of the InkStroke collection.

Attributes
See Also

Methods

AddStroke(InkStroke) AddStroke(InkStroke) AddStroke(InkStroke)

Adds an InkStroke object to the collection managed by the InkStrokeContainer.

An InkStroke cannot exist in more than one InkStrokeContainer. Call the Clone method to duplicate a stroke in another container.

public : void AddStroke(InkStroke stroke)public void AddStroke(InkStroke stroke)Public Function AddStroke(stroke As InkStroke) As void
Parameters
stroke
InkStroke InkStroke InkStroke

The ink stroke to be added.

stroke must be created by using the Clone method, or through a call to EndStroke or ProcessPointerUp. Empty or existing strokes are not valid.

Attributes
See Also

AddStrokes(IIterable<InkStroke>) AddStrokes(IIterable<InkStroke>) AddStrokes(IIterable<InkStroke>)

Adds one or more ink strokes to the collection managed by the InkStrokeContainer.

An InkStroke cannot exist in more than one InkStrokeContainer. Call the Clone method to duplicate a stroke in another container.

public : void AddStrokes(IIterable<InkStroke> strokes)public void AddStrokes(IEnumerable<InkStroke> strokes)Public Function AddStrokes(strokes As IEnumerable<InkStroke>) As void
Parameters
strokes
IIterable<InkStroke> IEnumerable<InkStroke> IEnumerable<InkStroke>

The ink strokes to be added as a collection of InkStroke objects.Each stroke must be created using the Clone method, or through a call to EndStroke or ProcessPointerUp. Empty or existing strokes are not valid.

Attributes
See Also

CanPasteFromClipboard() CanPasteFromClipboard() CanPasteFromClipboard()

Identifies whether content on the clipboard can be added to the InkStroke collection managed by the InkStrokeContainer.

Note

Clipboard content must be in Ink Serialized Format (ISF).

public : PlatForm::Boolean CanPasteFromClipboard()public bool CanPasteFromClipboard()Public Function CanPasteFromClipboard() As bool
Returns
PlatForm::Boolean bool bool

True if content can be pasted from the clipboard; otherwise, false.

Attributes
See Also

Clear() Clear() Clear()

Deletes all InkStroke objects from the collection managed by the InkStrokeContainer.

public : void Clear()public void Clear()Public Function Clear() As void
Attributes
See Also

CopySelectedToClipboard() CopySelectedToClipboard() CopySelectedToClipboard()

Copies the selected InkStroke objects (from the InkStroke collection managed by the InkStrokeContainer ) to the clipboard in Ink Serialized Format (ISF) format.

public : void CopySelectedToClipboard()public void CopySelectedToClipboard()Public Function CopySelectedToClipboard() As void
Attributes
See Also

DeleteSelected() DeleteSelected() DeleteSelected()

Deletes the selected InkStroke objects from the InkStroke collection managed by the InkStrokeContainer.

public : Rect DeleteSelected()public Rect DeleteSelected()Public Function DeleteSelected() As Rect
Returns

The bounding rectangle of the selected ink strokes, or the invalidated rectangle (0, 0, 0, 0) if no strokes were removed (no selected strokes).

Attributes

Remarks

This method does not cause the StrokesErased event to fire.

See Also

GetRecognitionResults() GetRecognitionResults() GetRecognitionResults()

Gets the collection of recognition matches previously processed by an InkRecognizer and stored in an InkRecognizerContainer.

Recognition is not supported by InkStrokeContainer, you must use an InkRecognizerContainer object.

public : IVectorView<InkRecognitionResult> GetRecognitionResults()public IReadOnlyList<InkRecognitionResult> GetRecognitionResults()Public Function GetRecognitionResults() As IReadOnlyList( Of InkRecognitionResult )
Returns
IVectorView<InkRecognitionResult> IReadOnlyList<InkRecognitionResult> IReadOnlyList<InkRecognitionResult>

The results of the recognition as a collection of InkRecognitionResult objects.

Attributes
See Also

GetStrokeById(UInt32) GetStrokeById(UInt32) GetStrokeById(UInt32)

Retrieves the single InkStroke with the specified ID.

public : InkStroke GetStrokeById(unsigned int id)public InkStroke GetStrokeById(UInt32 id)Public Function GetStrokeById(id As UInt32) As InkStroke
Parameters
id
unsigned int UInt32 UInt32

The Global Unique Identifier (GUID) used to identify a single ink stroke.

Returns

The single ink stroke.

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

GetStrokes() GetStrokes() GetStrokes()

Retrieves all ink strokes in the collection managed by the InkStrokeContainer.

public : IVectorView<InkStroke> GetStrokes()public IReadOnlyList<InkStroke> GetStrokes()Public Function GetStrokes() As IReadOnlyList( Of InkStroke )
Returns
IVectorView<InkStroke> IReadOnlyList<InkStroke> IReadOnlyList<InkStroke>

The ink strokes managed by the InkStrokeContainer as a collection of InkStroke objects.

Attributes
See Also

LoadAsync(IInputStream) LoadAsync(IInputStream) LoadAsync(IInputStream)

Asynchronously loads all InkStroke objects from the specified stream to the InkStroke collection that is managed by the InkStrokeContainer.

All existing strokes in the InkStrokeContainer are cleared before new strokes are loaded.

public : IAsyncActionWithProgress<ulong> LoadAsync(IInputStream inputStream)public IAsyncActionWithProgress<ulong> LoadAsync(IInputStream inputStream)Public Function LoadAsync(inputStream As IInputStream) As IAsyncActionWithProgress( Of ulong )
Parameters
inputStream
IInputStream IInputStream IInputStream

The target stream.

Returns

The status of the asynchronous operation as the number of bytes fetched. For more information, see ReadAsync method.

Attributes
See Also

MoveSelected(Point) MoveSelected(Point) MoveSelected(Point)

Moves the selected strokes. All affected strokes are re-rendered.

public : Rect MoveSelected(Point translation)public Rect MoveSelected(Point translation)Public Function MoveSelected(translation As Point) As Rect
Parameters
translation
Point Point Point

The destination screen coordinates for the upper-left corner of the bounding rectangle of the selected strokes.

Returns

The bounding rectangle of the selected ink strokes.

Attributes

Remarks

The following can result from a call to MoveSelected:

  • Moving one or more strokes that make up part of a word results in the reprocessing of existing ink recognition results.
  • Moving all strokes that make up a word results in the recalculation of the BoundingRect of the InkRecognitionResult. Ink recognition is not reprocessed.
  • Moving one or more strokes results in the recalculation of the BoundingRect for each stroke.
  • Moving one or more strokes results in the recalculation of the BoundingRect of the InkStrokeContainer.
See Also

PasteFromClipboard(Point) PasteFromClipboard(Point) PasteFromClipboard(Point)

Adds the InkStroke content from the clipboard to the InkStroke collection that is managed by the InkStrokeContainer and renders the new strokes..

public : Rect PasteFromClipboard(Point position)public Rect PasteFromClipboard(Point position)Public Function PasteFromClipboard(position As Point) As Rect
Parameters
position
Point Point Point

The screen coordinates for the upper-left corner of the bounding rectangle of the clipboard content.

Returns

The invalidated bounding rectangle of the InkStroke collection.

Attributes

Remarks

The content of the clipboard must be in Ink Serialized Format (ISF) format.

The InkStroke content from the clipboard is selected. Any existing selection is discarded.

See Also

SaveAsync(IOutputStream) SaveAsync(IOutputStream) SaveAsync(IOutputStream)

Asynchronously saves all InkStroke objects in the InkStroke collection that is managed by the InkStrokeContainer to the specified stream.

public : IAsyncOperationWithProgress<unsigned short, unsigned short> SaveAsync(IOutputStream outputStream)public IAsyncOperationWithProgress<uint, uint> SaveAsync(IOutputStream outputStream)Public Function SaveAsync(outputStream As IOutputStream) As IAsyncOperationWithProgress( Of uint, uint )
Parameters
outputStream
IOutputStream IOutputStream IOutputStream

The target stream. An IRandomAccessStream (requires IOutputStream ) object can be specified instead.

Returns
IAsyncOperationWithProgress<unsigned short, unsigned short> IAsyncOperationWithProgress<uint, uint> IAsyncOperationWithProgress<uint, uint>

The status of the asynchronous operation as the number of bytes sent. For more information, see WriteAsync method.

Attributes

SaveAsync(IOutputStream, InkPersistenceFormat) SaveAsync(IOutputStream, InkPersistenceFormat) SaveAsync(IOutputStream, InkPersistenceFormat)

Asynchronously saves all InkStroke objects in the InkStroke collection that is managed by the InkStrokeContainer to the specified stream and in the specified format.

public : IAsyncOperationWithProgress<unsigned short, unsigned short> SaveAsync(IOutputStream outputStream, InkPersistenceFormat inkPersistenceFormat)public IAsyncOperationWithProgress<uint, uint> SaveAsync(IOutputStream outputStream, InkPersistenceFormat inkPersistenceFormat)Public Function SaveAsync(outputStream As IOutputStream, inkPersistenceFormat As InkPersistenceFormat) As IAsyncOperationWithProgress( Of uint, uint )
Parameters
outputStream
IOutputStream IOutputStream IOutputStream

The target stream. An IRandomAccessStream (requires IOutputStream ) object can be specified instead.

inkPersistenceFormat
InkPersistenceFormat InkPersistenceFormat InkPersistenceFormat

The format in which to save the ink input.

Returns
IAsyncOperationWithProgress<unsigned short, unsigned short> IAsyncOperationWithProgress<uint, uint> IAsyncOperationWithProgress<uint, uint>

The status of the asynchronous operation as the number of bytes sent. For more information, see WriteAsync method.

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

SelectWithLine(Point, Point) SelectWithLine(Point, Point) SelectWithLine(Point, Point)

Selects all strokes intersected by the new stroke.

Note

The Selected flag is reset for all other strokes in the collection.

public : Rect SelectWithLine(Point from, Point to)public Rect SelectWithLine(Point from, Point to)Public Function SelectWithLine(from As Point, to As Point) As Rect
Parameters
from
Point Point Point

The start of the line.

to
Point Point Point

The of the line.

Returns

The bounding rectangle of the selected ink strokes.

Attributes
See Also

SelectWithPolyLine(IIterable<Point>) SelectWithPolyLine(IIterable<Point>) SelectWithPolyLine(IIterable<Point>)

Selects all strokes contained entirely within the polyline.

Note

The Selected flag is reset for all other strokes in the collection.

.

public : Rect SelectWithPolyLine(IIterable<Point> polyline)public Rect SelectWithPolyLine(IEnumerable<Point> polyline)Public Function SelectWithPolyLine(polyline As IEnumerable<Point>) As Rect
Parameters
polyline
IIterable<Point> IEnumerable<Point> IEnumerable<Point>

The points of the polyline.

Returns

The bounding rectangle of the selected ink strokes.

Attributes
See Also

UpdateRecognitionResults(IVectorView<InkRecognitionResult>) UpdateRecognitionResults(IVectorView<InkRecognitionResult>) UpdateRecognitionResults(IVectorView<InkRecognitionResult>)

Updates the collection of recognition matches previously processed by an InkRecognizer and stored in an InkRecognizerContainer.

Recognition is not supported by InkStrokeContainer, you must use an InkRecognizerContainer object.

public : void UpdateRecognitionResults(IVectorView<InkRecognitionResult> recognitionResults)public void UpdateRecognitionResults(IReadOnlyList<InkRecognitionResult> recognitionResults)Public Function UpdateRecognitionResults(recognitionResults As IReadOnlyList<InkRecognitionResult>) As void
Parameters
recognitionResults
IVectorView<InkRecognitionResult> IReadOnlyList<InkRecognitionResult> IReadOnlyList<InkRecognitionResult>

The updated collection of InkRecognitionResult objects.

Attributes
See Also

See Also