FrameworkElementFactory.AddHandler 方法

定义

向此 factory 创建的实例添加给定路由事件的事件处理程序。Adds an event handler for the given routed event to the instances created by this factory.

重载

AddHandler(RoutedEvent, Delegate)

向此 factory 创建的实例添加给定路由事件的事件处理程序。Adds an event handler for the given routed event to the instances created by this factory.

AddHandler(RoutedEvent, Delegate, Boolean)

将给定路由事件的事件处理程序添加到此工厂创建的实例,可以选择调用提供的处理程序,即使路由事件已经标记为在路由过程中由另一个元素处理。Adds an event handler for the given routed event to the instances created by this factory, with the option of having the provided handler be invoked even in cases of routed events that had already been marked as handled by another element along the route.

AddHandler(RoutedEvent, Delegate)

向此 factory 创建的实例添加给定路由事件的事件处理程序。Adds an event handler for the given routed event to the instances created by this factory.

public:
 void AddHandler(System::Windows::RoutedEvent ^ routedEvent, Delegate ^ handler);
public void AddHandler (System.Windows.RoutedEvent routedEvent, Delegate handler);
member this.AddHandler : System.Windows.RoutedEvent * Delegate -> unit
Public Sub AddHandler (routedEvent As RoutedEvent, handler As Delegate)

参数

routedEvent
RoutedEvent

要处理的路由事件的标识符对象。Identifier object for the routed event being handled.

handler
Delegate

对处理程序实现的引用。A reference to the handler implementation.

适用于

AddHandler(RoutedEvent, Delegate, Boolean)

将给定路由事件的事件处理程序添加到此工厂创建的实例,可以选择调用提供的处理程序,即使路由事件已经标记为在路由过程中由另一个元素处理。Adds an event handler for the given routed event to the instances created by this factory, with the option of having the provided handler be invoked even in cases of routed events that had already been marked as handled by another element along the route.

public:
 void AddHandler(System::Windows::RoutedEvent ^ routedEvent, Delegate ^ handler, bool handledEventsToo);
public void AddHandler (System.Windows.RoutedEvent routedEvent, Delegate handler, bool handledEventsToo);
member this.AddHandler : System.Windows.RoutedEvent * Delegate * bool -> unit
Public Sub AddHandler (routedEvent As RoutedEvent, handler As Delegate, handledEventsToo As Boolean)

参数

routedEvent
RoutedEvent

要处理的路由事件的标识符对象。Identifier object for the routed event being handled.

handler
Delegate

对处理程序实现的引用。A reference to the handler implementation.

handledEventsToo
Boolean

在路由事件已标记为在其参数对象中进行处理的情况下,是否调用处理程序。Whether to invoke the handler in cases where the routed event has already been marked as handled in its arguments object. 如果要在将路由事件标记为已处理时调用事件处理程序,则为 true;否则为 falsetrue to invoke the handler even when the routed event is marked handled; otherwise, false. 默认值为 falseThe default is false. 请求处理已处理路由事件的情况不多见。Asking to handle already-handled routed events is not common.

适用于