This documentation is archived and is not being maintained.

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)

public static class EventManager
You cannot directly create an instance of this class in XAML.

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 static readonly RoutedEvent ButtonColorChangedEvent = EventManager.RegisterRoutedEvent("ButtonColorChanged",RoutingStrategy.Bubble,typeof(DependencyPropertyChangedEventHandler),typeof(Shirt));

		public event RoutedEventHandler ButtonColorChanged  {
			add {AddHandler(ButtonColorChangedEvent,value);}
			remove { RemoveHandler(ButtonColorChangedEvent, value); }


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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0