Using an InkToolbar with InkCanvas in your Windows Universal Apps

Using an InkToolbar with InkCanvas in your Windows Universal Apps

Universal Windows Platform introduced a InkCanvas (Easy drawing and inking using new InkCanvas Control for Universal Windows App) control to easy drawing and a new Inking API to manage the inking. Binding an InkToolbar to the InkCanvas control will now enhance the capability of this control all together.  You can now have several options for drawing, erasing and highlighting etc. By default, the InkToolbar provides UI control for selecting ink, stroke size, ink color, pen tip as well as options for erasing.

In the App you need to just define the InkCanvas and the InkToolbar  and InCanvas controls. The InkCanvas provides the canvas area for drawing using inputs, and the InkToolbar  provides the enhanced controls.

  <InkCanvas x:Name="inkCanvas" />
        <InkToolbar x:Name="inkToolbar" HorizontalAlignment="Center" VerticalAlignment="Top" TargetInkCanvas="{x:Bind inkCanvas}" />

You have to define the input device type for your inCanvas control to let the control accepts inputs from those devices.

inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen;

Then simply run it.

 

image

 

The InkToolbar Control is fairly simple to use , just link another painting app toolbar.

imageimage

The addition of this control will definitely help developer to provide rich drawing / painting capabilities with no time / efforts.

 

Hope this helps !

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

2 Comments to “Using an InkToolbar with InkCanvas in your Windows Universal Apps”

Comments are closed.