Represents a collection of points that correspond to a stylus-down, move, and stylus-up sequence.

<Stroke   .../>

The Stroke object is not related to the Stroke property, which is a member of the Shape object.

The following example code shows how to create a Stroke that draws from points captured from an InkPresenter. Each stroke thus created is then added to the stroke collection of the InkPresenter.

var agCtrl;
var inkPresenter; // Corresponds to the InkPresenter element in XAML.
var newStroke = null; // The Stroke variable to use in mouse handlers.
// Specify DrawingAttributes variables.
var daWidth = 2;
var daHeight = 2;
var daColor = "Black";
var daOutlineColor = "Black";

function root_Loaded(sender, args) 
    // Get the HTML object that contains the Silverlight plug-in.
    agCtrl = sender.GetHost();
    inkPresenter = sender.findname("inkPresenterElement");

// Capture mouse movement when the left button is pressed, and create the stroke.
function InkPresenterMouseDown(sender,args)
   newStroke = agCtrl.content.createFromXaml('<Stroke/>');
   var da = agCtrl.content.CreateFromXaml('<DrawingAttributes/>');
   newStroke.DrawingAttributes = da;
   // Set the drawing attributes properties.
   newStroke.DrawingAttributes.Width = daWidth;
   newStroke.DrawingAttributes.Height = daHeight;
   newStroke.DrawingAttributes.Color = daColor;
   newStroke.DrawingAttributes.OutlineColor = daOutlineColor;

// Add the new points to the Stroke.
function InkPresenterMouseMove(sender,args)
   if (newStroke != null)

// Release the mouse.
function InkPresenterMouseUp(sender,args)
   newStroke = null;