Export (0) Print
Expand All

RoutedEvent.AddOwner Method

Associates another owner class with this routed event, and enables routing of the event and handling on this class.

Namespace: System.Windows
Assembly: PresentationCore (in presentationcore.dll)

'Declaration
Public Function AddOwner ( _
	ownerType As Type _
) As RoutedEvent
'Usage
Dim instance As RoutedEvent
Dim ownerType As Type
Dim returnValue As RoutedEvent

returnValue = instance.AddOwner(ownerType)
public RoutedEvent AddOwner (
	Type ownerType
)
public function AddOwner (
	ownerType : Type
) : RoutedEvent
You cannot use methods in XAML.

Parameters

ownerType

The type of the class where the routed event is added.

Return Value

The identifier field for the event. This return value should be used to set a public static read-only field that will store the identifier for the representation of the routed event on the owning class. This field must be accessible because it will be required to attach any instance handlers for the event when using the AddHandler utility method.

The owner type is used internally when resolving an event by name.

The following example adds the current class as another owner of an event defined in a different class. Here, AnotherEditContainer is the current class, and the EditStateChangedEvent RoutedEvent field is defined as a member of that class. The MyEditContainer class originally defined the event, registering it with the identically named EditStateChangedEvent identifier.

public static readonly RoutedEvent EditStateChangedEvent  = MyEditContainer.EditStateChangedEvent.AddOwner(typeof(AnotherEditContainer));

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft