StrokeCollection.Add(StrokeCollection) Method

Definition

Adds the specified strokes to the StrokeCollection.

public void Add (System.Windows.Ink.StrokeCollection strokes);

Parameters

strokes
StrokeCollection

The StrokeCollection to add to the collection.

Exceptions

A Stroke in strokes is already a member of the StrokeCollection.

strokes is null.

Examples

The following example demonstrates how to copy the ink in one InkCanvas onto another InkCanvas. This example assumes:

  • There are two InkCanvas objects called inkCanvas1 and inkCanvas2.

  • The Click event has been connected to the event handler.

// Copy the strokes from one InkCanvas to another InkCanvas.
private void CopyStrokes_Click(object sender, RoutedEventArgs e) 
{
    StrokeCollection strokes = inkCanvas1.Strokes.Clone();
    inkCanvas2.Strokes.Clear();
    inkCanvas2.Strokes.Add(strokes);
}

Remarks

The Add method raises the StrokesChanged event.

Applies to

Product Versions
.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