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. 이 메서드를 사용하여 클래스 또는 연결된 이벤트에서 라우트된 이벤트를 클래스로 처리할 수 있습니다. 자세한 내용은 라우트된 이벤트를 처리됨으로 표시하고 클래스 처리를 참조하세요.

메서드

Name Description
GetRoutedEvents()

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

GetRoutedEventsForOwner(Type)

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

RegisterClassHandler(Type, RoutedEvent, Delegate, Boolean)

이벤트 데이터가 이미 처리된 것으로 표시된 이벤트를 처리하는 옵션을 사용하여 특정 라우트된 이벤트에 대한 클래스 처리기를 등록합니다.

RegisterClassHandler(Type, RoutedEvent, Delegate)

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

RegisterRoutedEvent(String, RoutingStrategy, Type, Type)

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

적용 대상