Represents information about the state of the stylus.

Cannot be instantiated, must use an existing property value.

For mouse input that is used for ink support in lieu of a stylus, the DeviceType property returns Mouse.

The following example uses the PressureFactor property to determine the size of a stroke. The PressureFactor is obtained from the first StylusPoint of each stroke, and then the stroke Width and Height is calculated by multiplying the PressureFactor by 20.

var agCtrl;
var inkPresenter; // Corresponds to the InkPresenter element in XAML.
var newStroke = null; // The Stroke variable for mouse handlers.
var daWidth;
var daHeight;

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 then create the stroke.
function InkPresenterMouseDown(sender,args)
   newStroke = agCtrl.content.createFromXaml('<Stroke/>');
   // Get the DeviceType.
   if(args.GetStylusInfo().deviceType == "Stylus")
     var sps = args.GetStylusPoints(inkPresenter);
   // If the device type is not a stylus, use the default stroke height and width.
     daWidth = 3;
     daHeight = 3;
   // Set the drawing attributes properties.
   newStroke.DrawingAttributes.Width = daWidth;
   newStroke.DrawingAttributes.Height = daHeight;
   newStroke.DrawingAttributes.Color = "Blue";
   newStroke.DrawingAttributes.OutlineColor = "Orange";

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

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

// Set the size of the stroke based on the initial pressureFactor of the stroke.
function SetStylusStrokeSize(sps)
    var p;
    // Set variable p to the first StylusPoint in the Stroke.
    p = sps.getItem(0).pressureFactor;
    daWidth = p * 20.0;
    daHeight = p * 20.0;

Community Additions