Condividi tramite


DeviceType (StylusInfo)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets a value that indicates whether the stylus represents mouse, stylus, or touch input.

value = object.DeviceType
object.DeviceType = value

Property Value

Type: DeviceType Enumeration

The type of the input device, as a value of the enumeration.

This property is read-only. There is no default.

Managed Equivalent

StylusDevice

Remarks

You obtain StylusInfo by calling a method of the MouseEventArgs object that you get from input parameters for the mouse event handler. The stylus input model is tied to mouse events, so that the mouse can be used as a default input mode.

Example

The following example demonstrates how to display the type of device that was used to create the current StylusPoint.

// Capture mouse movement when the left button is pressed and create the stroke.
function InkPresenterMouseDown(sender,args)
{
  // Display the type of input device in a TextBlock.
  device.Text = args.GetStylusInfo().deviceType;
  
  inkPresenter.CaptureMouse();
  newStroke = agCtrl.content.createFromXaml('<Stroke/>');
  
  newStroke.StylusPoints.AddStylusPoints(args.GetStylusPoints(inkPresenter));
  inkPresenter.Strokes.Add(newStroke);
}

Applies To

StylusInfo