EventManager Class

 

Provides event-related utility methods that register routed events for class owners and add class handlers.

Namespace:   System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

System.Object
  System.Windows.EventManager

Public NotInheritable Class EventManager

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticGetRoutedEvents()

Returns identifiers for routed events that have been registered to the event system.

System_CAPS_pubmethodSystem_CAPS_staticGetRoutedEventsForOwner(Type)

Finds all routed event identifiers for events that are registered with the provided owner type.

System_CAPS_pubmethodSystem_CAPS_staticRegisterClassHandler(Type, RoutedEvent, Delegate)

Registers a class handler for a particular routed event.

System_CAPS_pubmethodSystem_CAPS_staticRegisterClassHandler(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.

System_CAPS_pubmethodSystem_CAPS_staticRegisterRoutedEvent(String, RoutingStrategy, Type, Type)

Registers a new routed event with the Windows Presentation Foundation (WPF) event system.

This class is most commonly used to register a new routed event, with RegisterRoutedEvent.

The second most common API usage is RegisterClassHandler. You use this method to enable class handling of a routed event on the class, or an attached event. For details, see Marking Routed Events as Handled, and Class Handling.

The following example show how to use this class to register a new routed event as a class member, along with the routed event "wrapper" technique of overriding the add and remove implementations for a CLR event.

Public Shared ReadOnly ButtonColorChangedEvent As RoutedEvent = EventManager.RegisterRoutedEvent("ButtonColorChanged",RoutingStrategy.Bubble,GetType(DependencyPropertyChangedEventHandler),GetType(Shirt))

Public Custom Event ButtonColorChanged As RoutedEventHandler
	AddHandler(ByVal value As RoutedEventHandler)
		MyBase.AddHandler(ButtonColorChangedEvent,value)
	End AddHandler
	RemoveHandler(ByVal value As RoutedEventHandler)
		MyBase.RemoveHandler(ButtonColorChangedEvent, value)
	End RemoveHandler
	RaiseEvent(ByVal sender As Object, ByVal e As RoutedEventArgs)
	End RaiseEvent
End Event

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: