Edit

Share via


Stylus.Captured Property

Definition

Gets the element to which the stylus is bound.

public:
 static property System::Windows::IInputElement ^ Captured { System::Windows::IInputElement ^ get(); };
public static System.Windows.IInputElement Captured { get; }
static member Captured : System.Windows.IInputElement
Public Shared ReadOnly Property Captured As IInputElement

Property Value

The IInputElement to which the stylus is bound.

Examples

The following example demonstrates how to ensure that the stylus is not captured when the user touches the stylus to the digitizer. This example assumes that the PreviewStylusDown event is connected to the event handler.

void Window1_PreviewStylusDown(object sender, StylusEventArgs e)
{
    IInputElement capturedElement = Stylus.Captured;

    if (capturedElement != null)
    {
        capturedElement.ReleaseStylusCapture();
    }
}
Private Sub Window1_PreviewStylusDown(ByVal sender As Object, ByVal e As StylusDownEventArgs) _
    Handles Me.PreviewStylusDown

    Dim capturedElement As IInputElement = Stylus.Captured

    If Not (capturedElement Is Nothing) Then
        capturedElement.ReleaseStylusCapture()
    End If

End Sub

Applies to