microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.29k stars 675 forks source link

InkCanvas not working in XAML Controls Gallery app #5896

Closed WillemBos closed 1 year ago

WillemBos commented 3 years ago

InkCanvas not working in XAML Controls Gallery app

Steps to reproduce the bug Steps to reproduce the behavior:

  1. Go to Open the XAML Controls Gallery app
  2. Search for InkCanvas
  3. Click with the mouse on the canvas and nothing happens

Expected behavior Click with the mouse on the canvas and something will be drawn Actual behavior Click with the mouse on the canvas and nothing happens

Screenshots

Version Info

Additional context

Windows 10 version:

Device form factor:

WillemBos commented 3 years ago

Windows 11 it's working

StevusPrimus commented 3 years ago

Still not working on Win10 version 2004 Build 19041 for mouse painting. Checked out from master and freshly build with Win10 version 2004 Build 19041. It works with https://github.com/microsoft/Windows-universal-samples/tree/main/Samples/SimpleInk/cs . After some investigation I have the impression the InkPresenter is not listening to the Pointer events anymore. Anyone has a rough idea where to investigate further?

stmoy commented 3 years ago

How strange! I'm able to draw: image

I wonder if it might be related to some underlying driver issue or something. In any case, I don't think the issue is with the Gallery itself (as the sample is very simple - just an InkCanvas) so moving this to the WinUI repo for further investigation.

StevusPrimus commented 3 years ago

Hi @stmoy did you draw with the mouse? I could not test with something else than a mouse.

stmoy commented 3 years ago

Hi @stmoy did you draw with the mouse? I could not test with something else than a mouse.

Yes indeed - I drew this rather awkwardly with my mouse 😅

StevusPrimus commented 2 years ago

Hi @stmoy, may I ask which commit and windows version you used to test?

StevusPrimus commented 2 years ago

Still not working on Win10 version 2004 Build 19041 for mouse painting. Checked out from master and freshly build with Win10 version 2004 Build 19041. It works with https://github.com/microsoft/Windows-universal-samples/tree/main/Samples/SimpleInk/cs . After some investigation I have the impression the InkPresenter is not listening to the Pointer events anymore. Anyone has a rough idea where to investigate further?

At that point in time the commit was 84c97f0

StevusPrimus commented 2 years ago

image Also we traced down the issue the commit in the gallery app. d4b13f7 is the first which is broken, it works with 1ab6078 and below.

stmoy commented 2 years ago

@StevusPrimus - thank you for the thorough investigation! We are following up internally on this - it seems like it might be related to a change that was fixed in Windows 11, but we're discussing what to do for Windows 10 users.

antokhio commented 2 years ago

Hi, i have the same problem, when i added InkCanvas it was also not working, then i tried workaround from that tread https://github.com/microsoft/microsoft-ui-xaml/issues/5299#issuecomment-875798060 mentioned here: https://github.com/microsoft/microsoft-ui-xaml/issues/6021 without success.

Next i noticed that https://docs.microsoft.com/en-us/samples/microsoft/windows-universal-samples/simpleink/ that sample still working properly, and started to investigate, seems the problem solving lines of code are:

InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
drawingAttributes.Color = Windows.UI.Colors.Red;
drawingAttributes.Size = new Size(penSize, penSize);
drawingAttributes.IgnorePressure = false;
drawingAttributes.FitToCurve = true;

inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
inkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Pen;

List after adding this to my project InkCanvas started to work straight away

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.