Skip to content

Latest commit

 

History

History
75 lines (45 loc) · 5.73 KB

inkpresenter.md

File metadata and controls

75 lines (45 loc) · 5.73 KB
-api-id -api-type -api-device-family-note
T:Windows.UI.Input.Inking.InkPresenter
winrt class
xbox

Windows.UI.Input.Inking.InkPresenter

-description

Provides properties, methods, and events for managing the input, processing, and rendering of ink input (standard and modified) for an InkCanvas control.

-remarks

For Universal Windows apps, we recommend using InkPresenter and the InkCanvas control instead of InkManager.

The InkPresenter class cannot be instantiated directly. It is returned as a property of an InkCanvas object.

Note

Standard ink input (pen tip or eraser tip/button) is not modified with a secondary affordance, such as a pen barrel button, right mouse button, or similar (see RightDragAction).

By default, both standard and modified ink input is managed entirely by the InkPresenter and rendered to the InkCanvas as either an ink stroke or an erase stroke, based on InkInputProcessingConfiguration.Mode.

Modified input can be passed through to your app for processing by setting InkInputProcessingConfiguration.RightDragAction to InkInputRightDragAction.LeaveUnprocessed.

All input can be passed through to your app for processing by setting InkInputProcessingConfiguration.Mode to None.

Leaving input unprocessed by the InkPresenter lets you support a customized ink experience and extended functionality such as selection.

For complete control of ink input and to render it to the Direct2D device context of your Universal Windows app, instead of the default InkCanvas control, call ActivateCustomDrying prior to loading the InkCanvas. This requires an IInkD2DRenderer object to manage the ink input (see the Complex ink sample).

Version history

Windows version SDK version Value added
1703 15063 HighContrastAdjustment
1803 17134 InputConfiguration

-examples

Here, we show how to overlay ink annotations on an image. For this example, ink data is not captured or saved by a corresponding InkPresenter.

<ScrollViewer>
  <Grid>
    <Image Source="<path>"></Image>
    <InkCanvas x:Name="inkCanvas"></InkCanvas>
  </Grid>
</ScrollView

Here, we configure the InkPresenter to interpret input data from both pen and mouse as ink strokes. We also set some initial ink stroke attributes used for rendering strokes to the InkCanvas.

[!code-csharpSnippetSetInitialStrokeAttributes]

Ink stroke attributes can be set dynamically to accommodate user preferences or app requirements.

Here, we let a user choose from a list of ink colors.

[!code-xamlSnippetUI]

We then handle changes to the selected color and update the ink stroke attributes accordingly.

[!code-csharpSnippetSetColorStrokeAttribute]

-see-also

Pen and stylus interactions, Get started: Support ink in your UWP app, Ink analysis sample (basic) (C#), Ink handwriting recognition sample (C#), Save and load ink strokes from an Ink Serialized Format (ISF) file, Save and load ink strokes from the clipboard, Ink toolbar location and orientation sample (basic), Ink toolbar location and orientation sample (dynamic), Coloring book sample, Family notes sample, Inking sample (JavaScript), Simple inking sample (C#/C++), Complex inking sample (C++), Ink analysis sample