It seems like these events will do the job:
InkCanvas.StrokesReplaced
(occurs when the Strokes property is set)StrokeCollection.StrokesChanged
(occurs when a stroke is added or removed)Stroke.StylusPointsChanged
(occurs when the shape of a stroke is changed)Stroke.StylusPointsReplaced
(occurs when the StylusPoints property is set)Stroke.DrawingAttributesChanged
(occurs when the attributes of a stroke are changed)Stroke.DrawingAttributesReplaced
(occurs when the DrawingAttributes property is set)
In my case, I never replace properties, or change drawing attributes, so I only use StrokeCollection.StrokesChanged
and Stroke.StylusPointsChanged
. Here is a snippet of my code.
public MainWindow()
{
inkCanvas.Strokes.StrokesChanged += Strokes_StrokesChanged;
}
private void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
{
// Mark dirty
foreach (Stroke stroke in e.Added)
{
stroke.StylusPointsChanged += stroke_StylusPointsChanged;
}
foreach (Stroke stroke in e.Removed)
{
stroke.StylusPointsChanged -= stroke_StylusPointsChanged;
}
}
private void stroke_StylusPointsChanged(object sender, System.EventArgs e)
{
// Mark dirty
}