Questa documentazione è stata archiviata e non viene gestita.

Metodo EventManager.RegisterClassHandler (Type, RoutedEvent, Delegate, Boolean)

Registers a class handler for a particular routed event, with the option to handle events where event data is already marked handled.

Spazio dei nomi: System.Windows
Assembly: PresentationCore (in presentationcore.dll)

public static void RegisterClassHandler (
	Type classType,
	RoutedEvent routedEvent,
	Delegate handler,
	bool handledEventsToo
public static void RegisterClassHandler (
	Type classType, 
	RoutedEvent routedEvent, 
	Delegate handler, 
	boolean handledEventsToo
public static function RegisterClassHandler (
	classType : Type, 
	routedEvent : RoutedEvent, 
	handler : Delegate, 
	handledEventsToo : boolean
Non è possibile utilizzare metodi in XAML.



The type of the class that is declaring class handling.


The routed event identifier of the event to handle.


A reference to the class handler implementation.


true to invoke this class handler even if arguments of the routed event have been marked as handled; false to retain the default behavior of not invoking the handler on any marked-handled event.

Class handlers are invoked before instance handlers. You can implement a class handler that has the behavior of marking the event as handled. Therefore, instance handlers for a class-handled event are not invoked unless the instance handlers register specifically for handled events.

Many of the WPF base element events provide class handling virtual methods. By overriding these methods in classes that inherit the base classes, you can implement class handling without calling RegisterClassHandler in static constructors. These class handling methods typically exist for input events and have names that start with "On" and end with the name of the event being class handled. For more information, see Marking Routed Events as Handled, and Class Handling.

Using this signature, class handlers can be registered to invoke upon handled events, by setting handledEventsToo set to true. Generally, you should do this only if there is a known handling issue you are trying to work around, such as input system handling from mouse or keyboard events.

Microsoft .NET Framework 3.0 è supportato in Windows Vista, Microsoft Windows XP SP2 e Windows Server 2003 SP1.

.NET Framework

Supportato in: