Skip to content

Latest commit

 

History

History
51 lines (32 loc) · 4.01 KB

inkcanvas.md

File metadata and controls

51 lines (32 loc) · 4.01 KB
-api-id -api-type
T:Windows.UI.Xaml.Controls.InkCanvas
winrt class

Windows.UI.Xaml.Controls.InkCanvas

-description

Defines an area that receives and displays all pen input as either an ink stroke or an erase stroke (input from an eraser tip, or the pen tip when modified with an erase button).

-xaml-syntax

<InkCanvas .../>

-remarks

An InkCanvas has default Height and Width properties of zero, unless it is the child of an element that automatically sizes its child elements, such as StackPanel or Grid controls.

InkCanvas has maximum height and width dimensions of 2^21 physical pixels.

By default, the InkCanvas does not support ink input from devices other than pen. You must specify support for other devices through the InputDeviceTypes of an InkPresenter object.

Associate an InkToolbar with an InkCanvas to provide a customizable and extensible collection of buttons that activate ink-related features in the InkCanvas. By default, the toolbar includes buttons for drawing, erasing, highlighting, and displaying a ruler.

An InkCanvas control is bound to a single instance of an InkPresenter object (exposed through the InkPresenter property). This object provides all default inking functionality exposed by the InkCanvas, along with a comprehensive set of APIs for additional customization.

The configuration of the InkPresenter determines the pointer event handling behavior of the InkCanvas. You must set InkPresenter.InputDeviceTypes to CoreInputDeviceTypes.None for the InkCanvas to process pointer events, otherwise they are passed to the InkPresenter object.

To handle pointer events with the InkPresenter object, you must set RightDragAction to LeaveUnprocessed to pass the input through as UnprocessedInput for custom processing by your app.

The InkCanvas control doesn't work if a Transform3D is set on the control or on any element in the XAML tree above the control.

-examples

Tip

For more info, design guidance, and code examples, see Inking controls.

If you have the WinUI 2 Gallery app installed, click here to open the app and see the InkCanvas in action.

-see-also

Pen and stylus interactions, Add an InkToolbar to a Universal Windows Platform (UWP) app, Get Started Tutorial: Support ink in your UWP app, FrameworkElement, InkToolbar, Simple ink sample (C#/C++), Complex ink sample (C++), Get Started Tutorial: Support ink in your UWP app, Coloring book sample, Family notes sample