I am working on a project that involves the WPF InkCanvas control. I chose to use WPF over UWP due to its ability to synchronously save and load ink strokes.
However, I cannot seem to prevent touch input from drawing on the canvas.
I have posted code below:
private void MainCanvas_TouchDown(object sender, TouchEventArgs e)
{
initialX = e.GetTouchPoint(null).Position.X;
initialY = e.GetTouchPoint(null).Position.Y;
e.Handled=true;
}
private void MainCanvas_TouchMove(object sender, TouchEventArgs e)
{
currentX = e.GetTouchPoint(null).Position.X;
currentY = e.GetTouchPoint(null).Position.Y;
e.Handled = true;
}
private void MainCanvas_TouchUp(object sender, TouchEventArgs e)
{
finalX = e.GetTouchPoint(null).Position.X;
finalY = e.GetTouchPoint(null).Position.Y;
double deltaX = finalX - currentX;
if (deltaX < -_swipeDeltaX)
{
notebook.SwitchToNextPage();
Render();
}
else if (deltaX > -_swipeDeltaX)
{
notebook.SwitchToPreviousPage();
Render();
}
else {
}
e.Handled =(true);
}