UIElement.OnStylusDown(StylusDownEventArgs) UIElement.OnStylusDown(StylusDownEventArgs) UIElement.OnStylusDown(StylusDownEventArgs) UIElement.OnStylusDown(StylusDownEventArgs) Method

定义

当某个未处理的 StylusDown 附加事件到达派生自此类的其路由中的某个元素时调用。Invoked when an unhandled StylusDown attached event reaches an element in its route that is derived from this class. 实现此方法可为此事件添加类处理。Implement this method to add class handling for this event.

protected:
 virtual void OnStylusDown(System::Windows::Input::StylusDownEventArgs ^ e);
protected virtual void OnStylusDown (System.Windows.Input.StylusDownEventArgs e);
abstract member OnStylusDown : System.Windows.Input.StylusDownEventArgs -> unit
override this.OnStylusDown : System.Windows.Input.StylusDownEventArgs -> unit
Protected Overridable Sub OnStylusDown (e As StylusDownEventArgs)

参数

注解

此方法没有默认实现。This method has no default implementation. 因为继承中的中间类可能实现此方法, 所以建议您在实现中调用基实现。Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation.

此方法的用途类似于 * 方法上公共语言运行时 (CLR)common language runtime (CLR)的事件模式: 此方法提供了通过建立类处理程序而不是实例处理程序来处理来自派生类的匹配事件的方法。The purpose of this method is similar to the 公共语言运行时 (CLR)common language runtime (CLR) event pattern On* methods: this method provides the means to handle the matching event from derived classes by establishing a class handler instead of an instance handler. 在这种情况下, 匹配事件是路由事件。In this case the matching event is a routed event. 对于路由事件, On * 方法的实现模式是不同的, 因为路由事件可以由子元素引发, 这不一定是将调用处理程序的元素。The implementation pattern of the On* methods is different for routed events because a routed event can be raised by a child element, which is not necessarily the element that will invoke handlers. 因此, 您的实现需要检查事件数据的源属性。Therefore, your implementation needs to examine the source properties of the event data. 大多数情况下, 它不应尝试 reraise 该事件。It should not try to reraise the event in most cases.

通过重写此方法或使用RegisterClassHandler注册类处理程序, UIElement可以在事件路由中收到事件时调用私有类处理程序方法。Either by overriding this method or by registering class handlers with RegisterClassHandler, derived classes of UIElement can call private class handler methods when the event is received along the event route. 适用于类处理的一种情况是操作事件数据, 并将路由事件标记为 "已处理"。One scenario where class handling is appropriate is to manipulate the event data and mark the routed event as handled.

适用于

另请参阅