Stylus.CurrentStylusDevice Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the stylus that represents the stylus currently in use.

Namespace:   System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)

public static StylusDevice CurrentStylusDevice {

Property Value

Type: System.Windows.Input.StylusDevice

The StylusDevice that represents the stylus currently in use.

The following example demonstrates how to erase the text that is selected with an inverted stylus. This example assumes that there is a TextBox called textBox1 and that the StylusUpEvent event is connected to the event handler.

void TextBoxStylusUp(object sender, StylusEventArgs e)
    StylusDevice currentStylus = Stylus.CurrentStylusDevice;

    if (currentStylus.Inverted)
        string selectedText = textbox1.SelectedText;
        textbox1.SelectedText = "";

.NET Framework
Available since 3.0
Return to top