InkCanvas.StrokeErasing Event

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Occurs just before a user erases a stroke.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public event InkCanvasStrokeErasingEventHandler StrokeErasing

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.

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

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

.NET Framework
Available since 3.0
Return to top
Show: