EventManager 클래스

정의

클래스 소유자에 대한 라우트된 이벤트를 등록하고 클래스 처리기를 추가하는 이벤트 관련 유틸리티 메서드를 제공합니다.

public ref class EventManager abstract sealed
public static class EventManager
type EventManager = class
Public Class EventManager
상속
EventManager

예제

다음 예제에서는 CLR 이벤트에 대한 추가 및 제거 구현을 재정의하는 라우트된 이벤트 "래퍼" 기술과 함께 이 클래스를 사용하여 새 라우트된 이벤트를 클래스 멤버로 등록하는 방법을 보여 줍니다.

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

설명

이 클래스는 가장 일반적으로 새 라우트된 이벤트를 등록 하는 데 사용 됩니다 RegisterRoutedEvent합니다.

두 번째로 일반적인 API 사용법은 .입니다 RegisterClassHandler. 이 메서드를 사용 하 여 연결된 된 이벤트 클래스에 대해 라우트된 이벤트의 클래스 처리를 사용 하도록 설정 합니다. 자세한 내용은 참조 하세요 라우트된 이벤트 것으로 표시를 처리 및 클래스 처리합니다.

메서드

GetRoutedEvents()

이벤트 시스템에 등록된 라우트된 이벤트의 식별자를 반환합니다.

GetRoutedEventsForOwner(Type)

제공된 소유자 형식으로 등록된 이벤트의 모든 라우트된 이벤트 식별자를 찾습니다.

RegisterClassHandler(Type, RoutedEvent, Delegate)

특정 라우트된 이벤트에 대한 클래스 처리기를 등록합니다.

RegisterClassHandler(Type, RoutedEvent, Delegate, Boolean)

특정 라우트된 이벤트에 대한 클래스 처리기를 등록하며, 이벤트 데이터가 이미 처리된 것으로 표시된 경우에도 이벤트를 처리할 수 있는 옵션이 있습니다.

RegisterRoutedEvent(String, RoutingStrategy, Type, Type)

새 라우트된 이벤트를 WPF(Windows Presentation Foundation) 이벤트 시스템에 등록합니다.

적용 대상