InkManager InkManager InkManager InkManager Class

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Provides properties and methods to manage the input, manipulation, and processing (including handwriting recognition) of one or more InkStroke objects.

Syntax

Declaration

public sealed class InkManagerpublic sealed class InkManagerPublic NotInheritable Class InkManager

Remarks

If recognition is not required, use an InkStrokeContainer object instead of an InkManager. Previous recognition results are still available through GetRecognitionResults().

If only recognition is required, and not storage, use an InkRecognizerContainer instead of an InkManager.

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

Examples

This example shows how to create an InkManager object.


var inkManager = new Windows.UI.Input.Inking.InkManager();

The following function demonstrates how to select all ink strokes on a canvas that are part of the stroke collection of this InkManager (inkManager).


function selectAll()
{
    inkManager.getStrokes().forEach(
        function (stroke) 
        {
            stroke.selected = 1;
        }
    );
}

For the complete example, see Ink App sample.

Constructors summary

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Properties summary

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Gets the bounding rectangle of the InkStroke collection that is managed by the InkManager.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Gets or sets the ink input mode.

Methods summary

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Adds one or more InkStroke objects to the collection managed by the InkManager.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Identifies whether content on the clipboard can be added to the InkStroke collection that is managed by the InkManager.

Note

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

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Retrieves the collection of words returned by handwriting recognition.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Gets the collection of installed handwriting recognizers.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Ink data is serialized as Ink Serialized Format (ISF) metadata and embedded into a Graphics Interchange Format (GIF) file.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Processes information about the position and features of the contact point, like pressure and tilt, on initial down contact. You must call this method before you call ProcessPointerUpdate(Windows.UI.Input.PointerPoint), and then ProcessPointerDown(Windows.UI.Input.PointerPoint)

Important

This method is not supported in desktop apps.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Processes information about the position and features of the contact point, like pressure and tilt, on up contact. You must call this method after you call ProcessPointerUpdate(Windows.UI.Input.PointerPoint).

Important

This method is not supported in desktop apps.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Processes position and state properties, such as pressure and tilt, for the specified pointer, from the last pointer event up to and including the current pointer event.Call this method after ProcessPointerDown(Windows.UI.Input.PointerPoint) and before ProcessPointerUp(Windows.UI.Input.PointerPoint).

Important

This method is not supported in desktop apps.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Performs handwriting recognition on one or more InkStroke objects.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Performs handwriting recognition on one or more InkStroke objects.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

Ink data is serialized as Ink Serialized Format (ISF) metadata and embedded into a Graphics Interchange Format (GIF) file.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Selects all strokes intersected by the new stroke.

Note

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

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Selects all strokes contained entirely within the polyline.

Note

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

.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Sets the default InkDrawingAttributes for all new InkStroke objects added to the InkStroke collection managed by the InkManager.

SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes) does not affect the current stroke, or any existing strokes.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Sets the default InkRecognizer used for handwriting recognition.

Note

For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

Updates the collection of potential text matches from handwriting recognition.

Constructors

  • InkManager()
    InkManager()
    InkManager()
    InkManager()
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

    public InkManager()public InkManager()Public Function InkManager() As

Properties

  • BoundingRect
    BoundingRect
    BoundingRect
    BoundingRect
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Gets the bounding rectangle of the InkStroke collection that is managed by the InkManager.

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

    Property Value

    Remarks

    Examples

    This example shows how to get the BoundingRect for the InkStroke collection of an InkManager object.

    var rect = inkManager.boundingRect;
    

    For the complete example, see Ink App sample.

  • Mode
    Mode
    Mode
    Mode
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Gets or sets the ink input mode.

    public InkManipulationMode Mode { get; set; }public InkManipulationMode Mode { get; set; }Public ReadWrite Property Mode As InkManipulationMode

    Property Value

Methods

  • AddStroke(Windows.UI.Input.Inking.InkStroke)
    AddStroke(Windows.UI.Input.Inking.InkStroke)
    AddStroke(Windows.UI.Input.Inking.InkStroke)
    AddStroke(Windows.UI.Input.Inking.InkStroke)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Adds one or more InkStroke objects to the collection managed by the InkManager.

    public void AddStroke(Windows.UI.Input.Inking.InkStroke stroke)public void AddStroke(Windows.UI.Input.Inking.InkStroke stroke)Public Function AddStroke(stroke As Windows.UI.Input.Inking.InkStroke) As void

    Parameters

  • CanPasteFromClipboard()
    CanPasteFromClipboard()
    CanPasteFromClipboard()
    CanPasteFromClipboard()
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Identifies whether content on the clipboard can be added to the InkStroke collection that is managed by the InkManager.

    Note

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

    public bool CanPasteFromClipboard()public bool CanPasteFromClipboard()Public Function CanPasteFromClipboard() As bool

    Returns

    • bool
      bool
      bool
      bool

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

  • CopySelectedToClipboard()
    CopySelectedToClipboard()
    CopySelectedToClipboard()
    CopySelectedToClipboard()
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

    public void CopySelectedToClipboard()public void CopySelectedToClipboard()Public Function CopySelectedToClipboard() As void
  • DeleteSelected()
    DeleteSelected()
    DeleteSelected()
    DeleteSelected()
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

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

  • GetRecognitionResults()
    GetRecognitionResults()
    GetRecognitionResults()
    GetRecognitionResults()
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Retrieves the collection of words returned by handwriting recognition.

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

    Returns

  • GetRecognizers()
    GetRecognizers()
    GetRecognizers()
    GetRecognizers()
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Gets the collection of installed handwriting recognizers.

    public IVectorView<InkRecognizer> GetRecognizers()public IVectorView<InkRecognizer> GetRecognizers()Public Function GetRecognizers() As IVectorView( Of InkRecognizer )

    Returns

    • The installed handwriting recognizers as a collection of InkRecognizer objects.

  • GetStrokes()
    GetStrokes()
    GetStrokes()
    GetStrokes()
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

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

    Returns

  • LoadAsync(Windows.Storage.Streams.IInputStream)
    LoadAsync(Windows.Storage.Streams.IInputStream)
    LoadAsync(Windows.Storage.Streams.IInputStream)
    LoadAsync(Windows.Storage.Streams.IInputStream)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

    Ink data is serialized as Ink Serialized Format (ISF) metadata and embedded into a Graphics Interchange Format (GIF) file.

    public IAsyncActionWithProgress<ulong> LoadAsync(Windows.Storage.Streams.IInputStream inputStream)public IAsyncActionWithProgress<ulong> LoadAsync(Windows.Storage.Streams.IInputStream inputStream)Public Function LoadAsync(inputStream As Windows.Storage.Streams.IInputStream) As IAsyncActionWithProgress( Of ulong )

    Parameters

    Returns

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

    Remarks

    Embedding the metadata into a Graphics Interchange Format (GIF) file enables ink to be viewed in applications that are not ink-enabled while maintaining full fidelity for ink-enabled applications. This format is ideal for transporting ink content within an HTML file and making it usable by both ink and non-ink applications.

    Note

    Ink Serialized Format (ISF) is the most compact persistent representation of ink. It can be embedded within a binary document format or placed directly on the Clipboard while preserving various ink properties such as pressure, width, color, tilt, twist, and so on.

    Examples

    The loadStrokes function in this example demonstrates how to:

    // Load strokes into an inkManager.
    function loadStrokes()
    {
        // Set up the file open screen.
        var openPicker = Windows.Storage.Pickers.FileOpenPicker();
        openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
        openPicker.fileTypeFilter.replaceAll([".gif"]);
    
        // Set up the stream.
        var loadStream = null;
    
        // Asynchronously load the ink data from the stream.
        openPicker.pickSingleFileAsync().done(
            function (file)
            {
                if (null != file)
                {
                    file.openAsync(Windows.Storage.FileAccessMode.read).then(
                        function (stream) {
                            loadStream = stream;
                            return inkManager.loadAsync(loadStream);
                        }).done(
                            function()
                            {
                                var strokes = inkManager.getStrokes().length;
                                if (strokes === 0)
                                {
                                    statusMessage.innerText = "No strokes in file.";
                                }
                                else
                                {
                                    statusMessage.innerText = strokes + " strokes loaded.";
                                }
                                renderAllStrokes();
                                loadStream.close();
                            },
                            function (e)
                            {
                                statusMessage.innerText = "Load failed.";
                                if (loadStream)
                                {
                                    // Close the stream if open.
                                    loadStream.close();
                                }
                            });
                }
            });
    }
    
  • MoveSelected(Windows.Foundation.Point)
    MoveSelected(Windows.Foundation.Point)
    MoveSelected(Windows.Foundation.Point)
    MoveSelected(Windows.Foundation.Point)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

    public Rect MoveSelected(Windows.Foundation.Point translation)public Rect MoveSelected(Windows.Foundation.Point translation)Public Function MoveSelected(translation As Windows.Foundation.Point) As Rect

    Parameters

    • translation

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

    Returns

    Remarks

    The following can result from a call to MoveSelected(Windows.Foundation.Point):

    • 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 InkManager.
  • PasteFromClipboard(Windows.Foundation.Point)
    PasteFromClipboard(Windows.Foundation.Point)
    PasteFromClipboard(Windows.Foundation.Point)
    PasteFromClipboard(Windows.Foundation.Point)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

    public Rect PasteFromClipboard(Windows.Foundation.Point position)public Rect PasteFromClipboard(Windows.Foundation.Point position)Public Function PasteFromClipboard(position As Windows.Foundation.Point) As Rect

    Parameters

    • position

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

    Returns

    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.

    Examples

    Here we show how to test whether the content on the clipboard can be added to an InkStroke collection before calling the PasteFromClipboard(Windows.Foundation.Point) method.

    This example specifies the insertion point for the bounding rectangle at (100, 60), but this can be customized as required.

    
    function paste(evt)
    {
        var insertionPoint = {x: 100, y: 60};
        var canPaste = inkManager.canPasteFromClipboard();
        if (canPaste)
        {
            inkManager.pasteFromClipboard(insertionPoint);
            sdkSample.displayStatus("Pasted");
            renderAllStrokes();
        }
        else
        {
            sdkSample.displayStatus("Cannot paste");
        }
    }
    

    For the complete example, see Ink App sample.

  • ProcessPointerDown(Windows.UI.Input.PointerPoint)
    ProcessPointerDown(Windows.UI.Input.PointerPoint)
    ProcessPointerDown(Windows.UI.Input.PointerPoint)
    ProcessPointerDown(Windows.UI.Input.PointerPoint)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Processes information about the position and features of the contact point, like pressure and tilt, on initial down contact. You must call this method before you call ProcessPointerUpdate(Windows.UI.Input.PointerPoint), and then ProcessPointerDown(Windows.UI.Input.PointerPoint)

    Important

    This method is not supported in desktop apps.

    public void ProcessPointerDown(Windows.UI.Input.PointerPoint pointerPoint)public void ProcessPointerDown(Windows.UI.Input.PointerPoint pointerPoint)Public Function ProcessPointerDown(pointerPoint As Windows.UI.Input.PointerPoint) As void

    Parameters

  • ProcessPointerUp(Windows.UI.Input.PointerPoint)
    ProcessPointerUp(Windows.UI.Input.PointerPoint)
    ProcessPointerUp(Windows.UI.Input.PointerPoint)
    ProcessPointerUp(Windows.UI.Input.PointerPoint)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Processes information about the position and features of the contact point, like pressure and tilt, on up contact. You must call this method after you call ProcessPointerUpdate(Windows.UI.Input.PointerPoint).

    Important

    This method is not supported in desktop apps.

    public Rect ProcessPointerUp(Windows.UI.Input.PointerPoint pointerPoint)public Rect ProcessPointerUp(Windows.UI.Input.PointerPoint pointerPoint)Public Function ProcessPointerUp(pointerPoint As Windows.UI.Input.PointerPoint) As Rect

    Parameters

    Returns

    • For Inking and Selecting modes, this is the bounding box for the stroke (invalidated rectangle). For Erasing mode, the invalidated rectangle is (0,0,0,0).

  • ProcessPointerUpdate(Windows.UI.Input.PointerPoint)
    ProcessPointerUpdate(Windows.UI.Input.PointerPoint)
    ProcessPointerUpdate(Windows.UI.Input.PointerPoint)
    ProcessPointerUpdate(Windows.UI.Input.PointerPoint)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Processes position and state properties, such as pressure and tilt, for the specified pointer, from the last pointer event up to and including the current pointer event.Call this method after ProcessPointerDown(Windows.UI.Input.PointerPoint) and before ProcessPointerUp(Windows.UI.Input.PointerPoint).

    Important

    This method is not supported in desktop apps.

    public object ProcessPointerUpdate(Windows.UI.Input.PointerPoint pointerPoint)public object ProcessPointerUpdate(Windows.UI.Input.PointerPoint pointerPoint)Public Function ProcessPointerUpdate(pointerPoint As Windows.UI.Input.PointerPoint) As object

    Parameters

    Returns

    Remarks

    Examples

    The following example demonstrates a handler for an onmspointermove event.

    Here, the unprocessed intermediate points (pts) since the last update are processed by the InkManager (inkManager) in the call to ProcessPointerUpdate(Windows.UI.Input.PointerPoint).

    function handlePointerMove(evt)
    {
        try
        {
            evt.preventManipulation();
            if (evt.pointerId === penID)
            {
                var pt = evt.currentPoint;
                context.lineTo(pt.rawPosition.x, pt.rawPosition.y);
                context.stroke();
                var pts = evt.intermediatePoints;
                var i;
                for (i = pts.length - 1; i >= 0 ; i--)
                {
                    inkManager.processPointerUpdate(pts[i]);
                }
            }
        }
        catch (e)
        {
            displayError("handlePointerMove " + e.toString());
        }
    }
    

    For the complete example, see Ink App sample.

  • RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget)
    RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget)
    RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget)
    RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Performs handwriting recognition on one or more InkStroke objects.

    public IAsyncOperation<InkRecognitionResult>> RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget recognitionTarget)public IAsyncOperation<InkRecognitionResult>> RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget recognitionTarget)Public Function RecognizeAsync(recognitionTarget As Windows.UI.Input.Inking.InkRecognitionTarget) As IAsyncOperation( Of InkRecognitionResult )

    Parameters

    Returns

    • The results of the recognition as a collection of InkRecognitionResult objects. Each item in the results returned by recognition represents one written word. Each word is associated with a ranked list of text strings (retrieved through a call to GetTextCandidates() ) as potential matches for the word.

    Remarks

    Because RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget) does not automatically update the existing recognition results stored in the InkManager, UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult}) is typically called after RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget) has completed.

  • RecognizeAsync(Windows.UI.Input.Inking.InkStrokeContainer,Windows.UI.Input.Inking.InkRecognitionTarget)
    RecognizeAsync(Windows.UI.Input.Inking.InkStrokeContainer,Windows.UI.Input.Inking.InkRecognitionTarget)
    RecognizeAsync(Windows.UI.Input.Inking.InkStrokeContainer,Windows.UI.Input.Inking.InkRecognitionTarget)
    RecognizeAsync(Windows.UI.Input.Inking.InkStrokeContainer,Windows.UI.Input.Inking.InkRecognitionTarget)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Performs handwriting recognition on one or more InkStroke objects.

    public IAsyncOperation<InkRecognitionResult>> RecognizeAsync(Windows.UI.Input.Inking.InkStrokeContainer strokeCollection,Windows.UI.Input.Inking.InkRecognitionTarget recognitionTarget)public IAsyncOperation<InkRecognitionResult>> RecognizeAsync(Windows.UI.Input.Inking.InkStrokeContainer strokeCollection,Windows.UI.Input.Inking.InkRecognitionTarget recognitionTarget)Public Function RecognizeAsync(strokeCollection As Windows.UI.Input.Inking.InkStrokeContainer,recognitionTarget As Windows.UI.Input.Inking.InkRecognitionTarget) As IAsyncOperation( Of InkRecognitionResult )

    Parameters

    Returns

    • The results of the recognition as a collection of InkRecognitionResult objects.Each item in the results returned by recognition represents one written word. Each word is associated with a ranked list of text strings (retrieved through a call to GetTextCandidates() ) as potential matches for the word.

    Remarks

    Because RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget) does not automatically update the existing recognition results stored in the InkManager, UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult}) is typically called after RecognizeAsync(Windows.UI.Input.Inking.InkRecognitionTarget) has completed.

  • SaveAsync(Windows.Storage.Streams.IOutputStream)
    SaveAsync(Windows.Storage.Streams.IOutputStream)
    SaveAsync(Windows.Storage.Streams.IOutputStream)
    SaveAsync(Windows.Storage.Streams.IOutputStream)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

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

    Ink data is serialized as Ink Serialized Format (ISF) metadata and embedded into a Graphics Interchange Format (GIF) file.

    public IAsyncOperationWithProgress<uint, uint> SaveAsync(Windows.Storage.Streams.IOutputStream outputStream)public IAsyncOperationWithProgress<uint, uint> SaveAsync(Windows.Storage.Streams.IOutputStream outputStream)Public Function SaveAsync(outputStream As Windows.Storage.Streams.IOutputStream) As IAsyncOperationWithProgress( Of uint, uint )

    Parameters

    Returns

    • The size of the saved stream and the status of the asynchronous operation as the number of bytes sent. For more information, see WriteAsync method.

    Remarks

    Embedding the metadata into a Graphics Interchange Format (GIF) file enables ink to be viewed in applications that are not ink-enabled while maintaining full fidelity for ink-enabled applications. This format is ideal for transporting ink content within an HTML file and making it usable by both ink and non-ink applications.

    Note

    Ink Serialized Format (ISF) is the most compact persistent representation of ink. It can be embedded within a binary document format or placed directly on the Clipboard while preserving various ink properties such as pressure, width, color, tilt, twist, and so on.

    Examples

    The saveStrokes function in this example demonstrates how to:

    // Save all strokes owned by inkManager.
    function saveStrokes()
    {
        // Ensure that strokes exist before calling saveAsync.
        if (inkManager.getStrokes().size > 0)
        {
            // Set up the file save screen.
            var savePicker = Windows.Storage.Pickers.FileSavePicker();
            savePicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
            savePicker.fileTypeChoices.insert("GIF with embedded ISF", [".gif"]);
            savePicker.defaultFileExtension = ".gif";
    
            // Set up the stream.
            var saveStream = null;
    
            // Asynchronously save the ink data to the stream.
            savePicker.pickSaveFileAsync().done(
            function (file)
            {
                if (null !== file)
                {
                    file.openAsync(Windows.Storage.FileAccessMode.readWrite).then(
                        function (stream)
                        {
                            saveStream = stream;
                            return inkManager.saveAsync(saveStream);
                        }
                    ).then(
                        function ()
                        {
                            return saveStream.flushAsync(); 
                        },
                        function (e) {
                            // Override the standard saveAsync error with our own.
                            throw new Error("saveAsync");
                        }
                    ).done(
                        function ()
                        {
                            statusMessage.innerText = "Strokes saved as GIF with embedded ISF (.gif).";
                            saveStream.close();
                        },
                        function (e) {
                            statusMessage.innerText = "Save: " + e.toString();
                            // Close the stream if open.
                            if (saveStream) {
                                saveStream.close();
                            }
                        }
                    );
                }
            }
        );
        }
        else
        {
            statusMessage.innerText = "No strokes to save.";
        }
    }
    
  • SelectWithLine(Windows.Foundation.Point,Windows.Foundation.Point)
    SelectWithLine(Windows.Foundation.Point,Windows.Foundation.Point)
    SelectWithLine(Windows.Foundation.Point,Windows.Foundation.Point)
    SelectWithLine(Windows.Foundation.Point,Windows.Foundation.Point)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Selects all strokes intersected by the new stroke.

    Note

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

    public Rect SelectWithLine(Windows.Foundation.Point from,Windows.Foundation.Point to)public Rect SelectWithLine(Windows.Foundation.Point from,Windows.Foundation.Point to)Public Function SelectWithLine(from As Windows.Foundation.Point,to As Windows.Foundation.Point) As Rect

    Parameters

    Returns

  • SelectWithPolyLine(Windows.Foundation.Collections.IIterable{Windows.Foundation.Point})
    SelectWithPolyLine(Windows.Foundation.Collections.IIterable{Windows.Foundation.Point})
    SelectWithPolyLine(Windows.Foundation.Collections.IIterable{Windows.Foundation.Point})
    SelectWithPolyLine(Windows.Foundation.Collections.IIterable{Windows.Foundation.Point})
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Selects all strokes contained entirely within the polyline.

    Note

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

    .

    public Rect SelectWithPolyLine(Windows.Foundation.Collections.IIterable{Windows.Foundation.Point} polyline)public Rect SelectWithPolyLine(Windows.Foundation.Collections.IIterable{Windows.Foundation.Point} polyline)Public Function SelectWithPolyLine(polyline As Windows.Foundation.Collections.IIterable{Windows.Foundation.Point}) As Rect

    Parameters

    • polyline

      The points of the polyline.

    Returns

  • SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes)
    SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes)
    SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes)
    SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Sets the default InkDrawingAttributes for all new InkStroke objects added to the InkStroke collection managed by the InkManager.

    SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes) does not affect the current stroke, or any existing strokes.

    public void SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes)public void SetDefaultDrawingAttributes(Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes)Public Function SetDefaultDrawingAttributes(drawingAttributes As Windows.UI.Input.Inking.InkDrawingAttributes) As void

    Parameters

  • SetDefaultRecognizer(Windows.UI.Input.Inking.InkRecognizer)
    SetDefaultRecognizer(Windows.UI.Input.Inking.InkRecognizer)
    SetDefaultRecognizer(Windows.UI.Input.Inking.InkRecognizer)
    SetDefaultRecognizer(Windows.UI.Input.Inking.InkRecognizer)
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Sets the default InkRecognizer used for handwriting recognition.

    public void SetDefaultRecognizer(Windows.UI.Input.Inking.InkRecognizer recognizer)public void SetDefaultRecognizer(Windows.UI.Input.Inking.InkRecognizer recognizer)Public Function SetDefaultRecognizer(recognizer As Windows.UI.Input.Inking.InkRecognizer) As void

    Parameters

  • UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult})
    UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult})
    UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult})
    UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult})
    Note

    For Universal Windows app using Extensible Application Markup Language (XAML), we recommend using InkPresenter and the InkCanvas control instead of InkManager.

    Updates the collection of potential text matches from handwriting recognition.

    public void UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult} recognitionResults)public void UpdateRecognitionResults(Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult} recognitionResults)Public Function UpdateRecognitionResults(recognitionResults As Windows.Foundation.Collections.IVectorView{Windows.UI.Input.Inking.InkRecognitionResult}) As void

    Parameters

    • recognitionResults

      The results returned by recognition, where each InkRecognitionResult object represents one written word.

      Note

      Each word is associated with a ranked list of text strings (retrieved through a call to GetTextCandidates() ) as potential matches for the word.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute

Details

Assembly

Windows.UI.Input.Inking.dll