question

SanthiyaArulsamy-9127 avatar image
SanthiyaArulsamy-9127 asked ·

Using InkCanvas for drawing free hand path is not working in Touch

Hi,
I am using InkCanvas control to draw the path over the image (which is inside the grid control). My requirement is to draw a path using single finger and zoom the image using double finger. But the actual behavior of Inkpresenter is when setting the InkPresenter's InputDeviceType as Mouse or Touch, it doesn't allow to detect the PointerEntered or PointerPressed to perform zoom after draw a path. If we set the InkPresenter's InputDeviceType as None we can use the above events to perform zoom.


For that, I am changing the InkPresenter's InputDeviceType as Mouse or Touch in grid's PointerEntered event and change the InkPresenter's InputDeviceType as None in InkPresenter's StrokeCollected event. This is properly working when i am trying to draw a path using mouse, but it does not work on Touch.

C# - Events

private void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)

{

canvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.None;

}


private void Grid_PointerEntered(object sender, PointerRoutedEventArgs e)

{

 canvas.InkPresenter.InputDeviceTypes =

Windows.UI.Core.CoreInputDeviceTypes.Mouse |
Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

}


Please find the POC sample.

Sample : https://drive.google.com/open?id=1wT9MvnJyXWR91ifUV3tJZJIaNluhfyK_

It is looking framework level issue. Anyone confirm this.?

windows-uwp
2 comments
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What device you tested with? Please share more detail about your os version and your project target and min version.

0 Votes 0 · ·

If the following answer is helpful please consider accept it

0 Votes 0 · ·

1 Answer

NicoZhu-MSFT avatar image
NicoZhu-MSFT answered ·

This is properly working when i am trying to draw a path using mouse, but it does not work on Touch.

It's by design, derive from this document

A touch point is only detectable if a finger is touching the surface. Whenever a touch action results in a PointerPressed event, that event is immediately preceded by a PointerEntered event, with all the event data being the same information for the two events (same pointer ID, same position, and so on.)

So, the point is pressed at that time. it does not work like the mouse.(need right click after pointer entered). And it will work when you raise finger and touch again.

Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.