RoutedEvent.AddOwner(Type) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
다른 소유자 형식에 RoutedEvent 인스턴스로 나타내는 라우트된 이벤트를 연결하고 이벤트 라우팅 및 처리를 사용하도록 설정합니다.
public:
System::Windows::RoutedEvent ^ AddOwner(Type ^ ownerType);
public System.Windows.RoutedEvent AddOwner (Type ownerType);
member this.AddOwner : Type -> System.Windows.RoutedEvent
Public Function AddOwner (ownerType As Type) As RoutedEvent
매개 변수
- ownerType
- Type
라우트된 이벤트가 추가되는 형식입니다.
반환
이벤트의 식별자 필드입니다. 이 반환 값을 사용하여 소유하는 형식에서 라우트된 이벤트를 나타내는 식별자가 저장될 public static 읽기 전용 필드를 설정해야 합니다. 사용자 코드가 AddHandler(RoutedEvent, Delegate, Boolean) 유틸리티 메서드를 사용할 때 라우트된 이벤트에 대한 인스턴스 처리기를 연결하기 위해 필드를 참조해야 하기 때문에 이 필드는 공용 액세스와 함께 정의됩니다.
예제
다음 예제에서는 현재 클래스를 다른 클래스에 정의된 이벤트의 다른 소유자로 추가합니다. AnotherEditContainer 다음은 현재 클래스이며 EditStateChangedEvent RoutedEvent 필드는 해당 클래스의 멤버로 정의됩니다. 클래스는 MyEditContainer 원래 동일한 명명 EditStateChangedEvent 된 식별자에 등록하여 이벤트를 정의했습니다.
public static readonly RoutedEvent EditStateChangedEvent = MyEditContainer.EditStateChangedEvent.AddOwner(typeof(AnotherEditContainer));
Public Shared ReadOnly EditStateChangedEvent As RoutedEvent = MyEditContainer.EditStateChangedEvent.AddOwner(GetType(AnotherEditContainer))
설명
소유자 유형은 이름으로 이벤트를 확인할 때 내부적으로 사용됩니다.