문제

Is there any way to detect that the stylus eraser button is pressed on a WPF element?

도움이 되었습니까?

해결책

The answer seems to be to detect if the pen is Inverted. http://msdn.microsoft.com/EN-US/library/ms607230(VS.110).aspx

(tested on Lenovo x61 tablet)

In MainWindow.Xaml

<TextBlock Name="textBox"
        Text="Hello World!" HorizontalAlignment="Center" VerticalAlignment="Center"
        StylusDown="TextBlock_StylusDown_1"/>

In MainWindow.Xaml.cs

 private void TextBlock_StylusDown_1(object sender, StylusDownEventArgs e)
    {
        if (e.Inverted)
            textBox.Text = "I've been erased";
        else
            textBox.Text = "Normal stylus";
    }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top