Stylus.PreviewStylusDown 附加事件


在用户将触笔的笔尖与手写板接触时发生。Occurs when user touches the tip of the stylus to the tablet.

see AddPreviewStylusDownHandler, and RemovePreviewStylusDownHandler
see AddPreviewStylusDownHandler, and RemovePreviewStylusDownHandler
see AddPreviewStylusDownHandler, and RemovePreviewStylusDownHandler


下面的示例演示如何确保当用户将触笔与手写板接触时,不捕获触笔。The following example demonstrates how to ensure that the stylus is not captured when the user touches the stylus to the tablet. 此示例假定事件已 PreviewStylusDown 连接到事件处理程序。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)
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
    End If

End Sub


这是一个附加事件。This is an attached event. WPFWPF 将附加事件作为路由事件实现。implements attached events as routed events. 附加事件本质上是一种 XAMLXAML 语言概念,它用于引用处理的事件,这些事件本身不是定义事件。An attached event is, fundamentally, a XAMLXAML language concept used to reference events that are handled on objects that do not, themselves, define events. WPFWPF 进一步扩展了附加事件的功能,从而允许它遍历路由。further expands an attached event's capabilities, allowing it to traverse a route. 附加事件在代码中没有直接处理语法;若要在代码中附加路由事件的处理程序,请使用指定的 Add * 处理程序方法。Attached events do not have a direct handling syntax in code; to attach handlers for a routed event in code, use a designated Add*Handler method. 有关详细信息,请参阅 附加事件概述For details, see Attached Events Overview.

路由事件信息Routed Event Information

标识符字段Identifier field PreviewStylusDownEvent
路由策略Routing strategy 隧道Tunneling
委托Delegate StylusDownEventHandler