How to Erase InkCanvas Strokes in Universal Windows Platform (Windows 10) app?

2.6k views Asked by At

Working with the InkCanvas control using the Universal Windows Platform (UWP) I can't seem to determine the correct method to erase ink strokes when using the InkCanvas - there's an event "StrokeErased" that can be handled.

Ideally the "InkCanvasEditingMode" on "InkCanvas.EditingMode" value to be set to either "InkCanvasEditingMode.EraseByPoint" or "InkCanvasEditingMode.EraseByStroke" would be used but these aren't available in the InkCanvas under Windows 10.

The example https://github.com/Microsoft/Windows-universal-samples/tree/master/simpleink mentions "Erase ink strokes" but the example just handles the StrokeErased event with no actual support for the erasing of them that I can see, what am I missing?

1

There are 1 answers

1
Rob Caplan - MSFT On BEST ANSWER

To let the user erase strokes (similar to WPF's InkCanvasEditingMode) set the InkCanvas's InkPresenter's InputProcessingConfiguration.Mode to InkInputProcessingMode.Erasing .

canvas.InkPresenter.InputProcessingConfiguration.Mode = Windows.UI.Input.Inking.InkInputProcessingMode.Erasing;