Reputation: 27350
Is there any way to detect when user presses or releases button on the pen within APP?
Either the top button, or "right click" button on surface pen
Alternatively, how to detect, that the button is pressed when pen touches InkCanvas
.
Upvotes: 2
Views: 976
Reputation: 1
If you want the InkCanvas.InkPresenter.UnprocessedInput.PointerPressed
to work you got to set the InkCanvas.InkPresenter.InputProcessingConfiguration.Mode
to InkInputProcessingMode.None
but with that done your InkCanvas
wont draw or erase any strokes anymore until you progrramed your own draw/erase method.
Upvotes: 0
Reputation: 1488
You may subscribe to PointerPressed event on InkCanvas. It has args PointerRoutedEventArgs e. Filter your input device and separate buttons like this:
if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen)
{
var point = e.GetCurrentPoint(YourCanvasName);
if (point.Properties.IsLeftButtonPressed)
{
//Button1
}
if (point.Properties.IsMiddleButtonPressed)
{
//Button2
}
if (point.Properties.IsRightButtonPressed)
{
//Button3
}
}
Should work though i don't have a pen to test :)
Upvotes: 1