FrameworkElementFactory.AddHandler Method

Definition

Adds an event handler for the given routed event to the instances created by this factory.

Overloads

AddHandler(RoutedEvent, Delegate)

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)

Adds an event handler for the given routed event to the instances created by this factory.

C#
public void AddHandler(System.Windows.RoutedEvent routedEvent, Delegate handler);

Parameters

routedEvent
RoutedEvent

Identifier object for the routed event being handled.

handler
Delegate

A reference to the handler implementation.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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.

C#
public void AddHandler(System.Windows.RoutedEvent routedEvent, Delegate handler, bool handledEventsToo);

Parameters

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 to invoke the handler even when the routed event is marked handled; otherwise, false. The default is false. Asking to handle already-handled routed events is not common.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10