Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Stylus Class

Provides access to general information about a tablet pen.

System.Object
  System.Windows.Input.Stylus

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)
public static class Stylus

The Stylus type exposes the following members.

  NameDescription
Public propertyStatic memberCapturedGets the element to which the stylus is bound.
Public propertyStatic memberCurrentStylusDeviceGets the stylus that represents the stylus currently in use.
Public propertyStatic memberDirectlyOverGets the element that is directly beneath the stylus.
Top
  NameDescription
Public attached propertyIsFlicksEnabledGets or sets a value indicating whether flicks are enabled.
Public attached propertyIsPressAndHoldEnabledGets or sets a values indicating whether press and hold is enabled.
Public attached propertyIsTapFeedbackEnabledGets or sets whether a value indicating whether tap feedback is enabled.
Public attached propertyIsTouchFeedbackEnabledGets or sets whether a value indicating whether touch feedback is enabled.
Top
  NameDescription
Public methodStatic memberAddGotStylusCaptureHandlerAdds a handler for the GotStylusCapture attached event.
Public methodStatic memberAddLostStylusCaptureHandlerAdds a handler for the LostStylusCapture attached event.
Public methodStatic memberAddPreviewStylusButtonDownHandlerAdds a handler for the PreviewStylusButtonDown attached event.
Public methodStatic memberAddPreviewStylusButtonUpHandlerAdds a handler for the PreviewStylusButtonUp attached event.
Public methodStatic memberAddPreviewStylusDownHandlerAdds a handler for the PreviewStylusDown attached event.
Public methodStatic memberAddPreviewStylusInAirMoveHandlerAdds a handler for the PreviewStylusInAirMove attached event.
Public methodStatic memberAddPreviewStylusInRangeHandlerAdds a handler for the PreviewStylusInRange attached event.
Public methodStatic memberAddPreviewStylusMoveHandlerAdds a handler for the PreviewStylusMove attached event.
Public methodStatic memberAddPreviewStylusOutOfRangeHandlerAdds a handler for the PreviewStylusOutOfRange attached event.
Public methodStatic memberAddPreviewStylusSystemGestureHandlerAdds a handler for the PreviewStylusSystemGesture attached event.
Public methodStatic memberAddPreviewStylusUpHandlerAdds a handler for the PreviewStylusUp attached event.
Public methodStatic memberAddStylusButtonDownHandlerAdds a handler for the StylusButtonDown attached event.
Public methodStatic memberAddStylusButtonUpHandlerAdds a handler for the StylusButtonUp attached event.
Public methodStatic memberAddStylusDownHandlerAdds a handler for the StylusDown attached event.
Public methodStatic memberAddStylusEnterHandlerAdds a handler for the StylusEnter attached event.
Public methodStatic memberAddStylusInAirMoveHandlerAdds a handler for the StylusInAirMove attached event.
Public methodStatic memberAddStylusInRangeHandlerAdds a handler for the StylusInRange attached event.
Public methodStatic memberAddStylusLeaveHandlerAdds a handler for the StylusLeave attached event.
Public methodStatic memberAddStylusMoveHandlerAdds a handler for the StylusMove attached event.
Public methodStatic memberAddStylusOutOfRangeHandlerAdds a handler for the StylusOutOfRange attached event.
Public methodStatic memberAddStylusSystemGestureHandlerAdds a handler for the StylusSystemGesture attached event.
Public methodStatic memberAddStylusUpHandlerAdds a handler for the StylusUp attached event.
Public methodStatic memberCapture(IInputElement)Captures the stylus to the specified element.
Public methodStatic memberCapture(IInputElement, CaptureMode)Captures the stylus to the specified element.
Public methodStatic memberGetIsFlicksEnabledGets the value of the IsFlicksEnabled attached property on the specified element.
Public methodStatic memberGetIsPressAndHoldEnabledGets the value of the IsPressAndHoldEnabled attached property on the specified element.
Public methodStatic memberGetIsTapFeedbackEnabledGets the value of the IsTapFeedbackEnabled attached property on the specified element.
Public methodStatic memberGetIsTouchFeedbackEnabledGets the value of the IsTouchFeedbackEnabled attached property on the specified element.
Public methodStatic memberRemoveGotStylusCaptureHandlerRemoves a handler for the GotStylusCapture attached event.
Public methodStatic memberRemoveLostStylusCaptureHandlerRemoves a handler for the LostStylusCapture attached event.
Public methodStatic memberRemovePreviewStylusButtonDownHandlerRemoves a handler for the PreviewStylusButtonDown attached event.
Public methodStatic memberRemovePreviewStylusButtonUpHandlerRemoves a handler for the PreviewStylusButtonUp attached event.
Public methodStatic memberRemovePreviewStylusDownHandlerRemoves a handler for the PreviewStylusDown attached event.
Public methodStatic memberRemovePreviewStylusInAirMoveHandlerRemoves a handler for the PreviewStylusInAirMove attached event.
Public methodStatic memberRemovePreviewStylusInRangeHandlerRemoves a handler for the PreviewStylusInRange attached event.
Public methodStatic memberRemovePreviewStylusMoveHandlerRemoves a handler for the PreviewStylusMove attached event.
Public methodStatic memberRemovePreviewStylusOutOfRangeHandlerRemoves a handler for the PreviewStylusOutOfRange attached event.
Public methodStatic memberRemovePreviewStylusSystemGestureHandlerRemoves a handler for the PreviewStylusSystemGesture attached event.
Public methodStatic memberRemovePreviewStylusUpHandlerRemoves a handler for the PreviewStylusUp attached event.
Public methodStatic memberRemoveStylusButtonDownHandlerRemoves a handler for the StylusButtonDown attached event.
Public methodStatic memberRemoveStylusButtonUpHandlerRemoves a handler for the StylusButtonUp attached event.
Public methodStatic memberRemoveStylusDownHandlerRemoves a handler for the StylusDown attached event.
Public methodStatic memberRemoveStylusEnterHandlerRemoves a handler for the StylusEnter attached event.
Public methodStatic memberRemoveStylusInAirMoveHandlerRemoves a handler for the StylusInAirMove attached event.
Public methodStatic memberRemoveStylusInRangeHandlerRemoves a handler for the StylusInRange attached event.
Public methodStatic memberRemoveStylusLeaveHandlerRemoves a handler for the StylusLeave attached event.
Public methodStatic memberRemoveStylusMoveHandlerRemoves a handler for the StylusMove attached event.
Public methodStatic memberRemoveStylusOutOfRangeHandlerRemoves a handler for the StylusOutOfRange attached event.
Public methodStatic memberRemoveStylusSystemGestureHandlerRemoves a handler for the StylusSystemGesture attached event.
Public methodStatic memberRemoveStylusUpHandlerRemoves a handler for the StylusUp attached event.
Public methodStatic memberSetIsFlicksEnabledGets the value of the IsFlicksEnabled attached property on the specified element.
Public methodStatic memberSetIsPressAndHoldEnabledSets the value of the IsPressAndHoldEnabled attached property on the specified element.
Public methodStatic memberSetIsTapFeedbackEnabledSets the value of the IsTapFeedbackEnabled attached property on the specified element.
Public methodStatic memberSetIsTouchFeedbackEnabledSets the value of the IsTouchFeedbackEnabled attached property on the specified element.
Public methodStatic memberSynchronizeSynchronizes the cursor and the user interface.
Top
  NameDescription
Public attached eventGotStylusCaptureOccurs when an element captures the stylus events.
Public attached eventLostStylusCaptureOccurs when an element releases stylus events.
Public attached eventPreviewStylusButtonDownOccurs when the user presses one of the buttons on the stylus.
Public attached eventPreviewStylusButtonUpOccurs when the user releases one of the buttons on the stylus.
Public attached eventPreviewStylusDownOccurs when user touches the tip of the stylus to the tablet.
Public attached eventPreviewStylusInAirMoveOccurs if the stylus moves while it is within range of (but not touching) the tablet.
Public attached eventPreviewStylusInRangeOccurs when the stylus comes within range of the tablet.
Public attached eventPreviewStylusMoveOccurs when the stylus moves while it is touching the tablet.
Public attached eventPreviewStylusOutOfRangeOccurs when the stylus goes out of range of the tablet.
Public attached eventPreviewStylusSystemGestureOccurs when the user makes a system gesture with this stylus.
Public attached eventPreviewStylusUpOccurs when the user lifts the stylus from the tablet.
Public attached eventStylusButtonDownOccurs when the user presses one of the buttons on the stylus.
Public attached eventStylusButtonUpOccurs when the user releases one of the buttons on the stylus.
Public attached eventStylusDownOccurs when the user touches the tip of the stylus to the tablet.
Public attached eventStylusEnterOccurs when the stylus cursor enters the bounds of an element.
Public attached eventStylusInAirMoveOccurs when the stylus moves while it is in range of, but not touching, the tablet.
Public attached eventStylusInRangeOccurs when the stylus comes within range of the tablet.
Public attached eventStylusLeaveOccurs when the stylus cursor leaves the bounds of an element.
Public attached eventStylusMoveOccurs when the stylus moves while it is touching the tablet.
Public attached eventStylusOutOfRangeOccurs when the stylus goes out of range of the tablet.
Public attached eventStylusSystemGestureOccurs when the user makes a system gesture with this stylus.
Public attached eventStylusUpOccurs when the user raises the stylus from the Tablet PC.
Top
  NameDescription
Public fieldStatic memberGotStylusCaptureEventIdentifies the GotStylusCapture attached event.
Public fieldStatic memberIsFlicksEnabledPropertyIdentifies the IsFlicksEnabled attached property.
Public fieldStatic memberIsPressAndHoldEnabledPropertyIdentifies the IsPressAndHoldEnabled attached property.
Public fieldStatic memberIsTapFeedbackEnabledPropertyIdentifies the IsTapFeedbackEnabled attached property.
Public fieldStatic memberIsTouchFeedbackEnabledPropertyIdentifies the IsTouchFeedbackEnabled attached property.
Public fieldStatic memberLostStylusCaptureEventIdentifies the LostStylusCapture attached event.
Public fieldStatic memberPreviewStylusButtonDownEventIdentifies the PreviewStylusButtonDown attached event.
Public fieldStatic memberPreviewStylusButtonUpEventIdentifies the PreviewStylusButtonUp attached event.
Public fieldStatic memberPreviewStylusDownEventIdentifies the PreviewStylusDown attached event.
Public fieldStatic memberPreviewStylusInAirMoveEventIdentifies the PreviewStylusInAirMove attached event.
Public fieldStatic memberPreviewStylusInRangeEventIdentifies the PreviewStylusInRange attached event.
Public fieldStatic memberPreviewStylusMoveEventIdentifies the PreviewStylusMove attached event.
Public fieldStatic memberPreviewStylusOutOfRangeEventIdentifies the PreviewStylusOutOfRange attached event.
Public fieldStatic memberPreviewStylusSystemGestureEventIdentifies the PreviewStylusSystemGesture attached event.
Public fieldStatic memberPreviewStylusUpEventIdentifies the PreviewStylusUp attached event.
Public fieldStatic memberStylusButtonDownEventIdentifies the StylusButtonDown attached event.
Public fieldStatic memberStylusButtonUpEventIdentifies the StylusButtonUp attached event.
Public fieldStatic memberStylusDownEventIdentifies the StylusDown attached event.
Public fieldStatic memberStylusEnterEventIdentifies the StylusEnter attached event.
Public fieldStatic memberStylusInAirMoveEventIdentifies the StylusInAirMove attached event.
Public fieldStatic memberStylusInRangeEventIdentifies the StylusInRange attached event.
Public fieldStatic memberStylusLeaveEventIdentifies the StylusLeave attached event.
Public fieldStatic memberStylusMoveEventIdentifies the StylusMove attached event.
Public fieldStatic memberStylusOutOfRangeEventIdentifies the StylusOutOfRange attached event.
Public fieldStatic memberStylusSystemGestureEventIdentifies the StylusSystemGesture attached event.
Public fieldStatic memberStylusUpEventIdentifies the StylusUp attached event.
Top

The following example demonstrates how to record the coordinates of the stylus, even if the stylus leaves the bounds of a TextBox. This example assumes that there is a TextBox called textBox1, and that the StylusDown, StylusUp, and StylusMove events are connected to event handlers.

void textbox1_StylusDown(object sender, StylusDownEventArgs e)
{
    Stylus.Capture(textbox1);
}

void textbox1_StylusMove(object sender, StylusEventArgs e)
{
    Point pos = e.GetPosition(textbox1);
    textbox1.AppendText("X: " + pos.X + " Y: " + pos.Y + "\n");
}

void textbox1_StylusUp(object sender, StylusEventArgs e)
{
    Stylus.Capture(textbox1, CaptureMode.None);
}

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.