InkCanvas.StrokeErasing Event

Definition

Occurs just before a user erases a stroke.

C#
public event System.Windows.Controls.InkCanvasStrokeErasingEventHandler StrokeErasing;

Event Type

Examples

The following example prevents any strokes rendered as highlighters from being erased. The example assumes that the InkCanvas is connected to the event handler.

C#
void inkCanvas1_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
{
    if (e.Stroke.DrawingAttributes.IsHighlighter)
    {
        e.Cancel = true;
    }
}

Remarks

Handle this event when you want to check whether a stroke should be erased. Set the Cancel property to true if you want to prevent the stroke from being erased. You can use this technique when the EditingMode or EditingModeInverted property is set to EraseByStroke or EraseByPoint.

Applies to

Producto Versiones
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10