How to set EraserShape of an InkCanvas in WPF

EraserShape property that is a type of StylusShape class represents the shape of the stylus that is used to point-erase ink from an InkCanvas.

The StylusShape class represents the tip of stylus. This is an abstract base class and used through its two derived classes EllipseStylusShape and RectangleStylusShape. The EllipseStylusShape represents a stylus tip shaped like an ellipse and RectangleStylusShape represents a stylus tip shaped like a rectangle.

StylusShape has three properties – Height, Width, and Rotation. The following code snippet creates an EllipseStylusShape and sets EraserShape property of InkCanvas.

// Create StylusShape

EllipseStylusShape ellipseStylus = new EllipseStylusShape(5, 5, 0);

MCInkCanvas.EraserShape = ellipseStylus;