EventManager EventManager EventManager EventManager Class

Definición

Proporciona métodos de utilidad relacionados con eventos que registran eventos enrutados para los propietarios de la clase y agregan controladores de clases.Provides event-related utility methods that register routed events for class owners and add class handlers.

public ref class EventManager abstract sealed
public static class EventManager
type EventManager = class
Public Class EventManager
Herencia
EventManagerEventManagerEventManagerEventManager

Ejemplos

En el ejemplo siguiente se muestra cómo usar esta clase para registrar un nuevo evento enrutado como un miembro de clase, junto con la técnica de "contenedor" de eventos enrutados de invalidar las implementaciones de adición y eliminación de un CLRCLR evento.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 CLRCLR 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); }
}
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

Comentarios

Esta clase se usa normalmente para registrar un nuevo evento enrutado, con RegisterRoutedEvent.This class is most commonly used to register a new routed event, with RegisterRoutedEvent.

El segundo uso más APIAPI común es RegisterClassHandler.The second most common APIAPI usage is RegisterClassHandler. Este método se usa para habilitar el control de clases de un evento enrutado en la clase o un evento adjunto.You use this method to enable class handling of a routed event on the class, or an attached event. Para obtener más información, vea marcar eventos enrutados como controlados y control de clases.For details, see Marking Routed Events as Handled, and Class Handling.

Métodos

GetRoutedEvents() GetRoutedEvents() GetRoutedEvents() GetRoutedEvents()

Devuelve los identificadores de los eventos enrutados registrados en el sistema de eventos.Returns identifiers for routed events that have been registered to the event system.

GetRoutedEventsForOwner(Type) GetRoutedEventsForOwner(Type) GetRoutedEventsForOwner(Type) GetRoutedEventsForOwner(Type)

Busca eventos en todos los identificadores de eventos enrutados con el tipo de propietario proporcionado.Finds all routed event identifiers for events that are registered with the provided owner type.

RegisterClassHandler(Type, RoutedEvent, Delegate) RegisterClassHandler(Type, RoutedEvent, Delegate) RegisterClassHandler(Type, RoutedEvent, Delegate) RegisterClassHandler(Type, RoutedEvent, Delegate)

Registra un controlador de clase de un evento enrutado concreto.Registers a class handler for a particular routed event.

RegisterClassHandler(Type, RoutedEvent, Delegate, Boolean) RegisterClassHandler(Type, RoutedEvent, Delegate, Boolean) RegisterClassHandler(Type, RoutedEvent, Delegate, Boolean) RegisterClassHandler(Type, RoutedEvent, Delegate, Boolean)

Registra un controlador de clase de un evento enrutado concreto, con la opción de controlar los eventos en los que los datos del evento ya estén marcados como controlados.Registers a class handler for a particular routed event, with the option to handle events where event data is already marked handled.

RegisterRoutedEvent(String, RoutingStrategy, Type, Type) RegisterRoutedEvent(String, RoutingStrategy, Type, Type) RegisterRoutedEvent(String, RoutingStrategy, Type, Type) RegisterRoutedEvent(String, RoutingStrategy, Type, Type)

Registra un nuevo evento enrutado en el sistema de eventos del Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF).Registers a new routed event with the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) event system.

Se aplica a