WindowsRuntimeMarshal.AddEventHandler<T> Method

Definition

Adds the specified event handler to a Windows Runtime event.

This API supports the product infrastructure and is not intended to be used directly from your code.

public:
generic <typename T>
 static void AddEventHandler(Func<T, System::Runtime::InteropServices::WindowsRuntime::EventRegistrationToken> ^ addMethod, Action<System::Runtime::InteropServices::WindowsRuntime::EventRegistrationToken> ^ removeMethod, T handler);
[System.Security.SecurityCritical]
public static void AddEventHandler<T> (Func<T,System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> addMethod, Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> removeMethod, T handler);
public static void AddEventHandler<T> (Func<T,System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> addMethod, Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> removeMethod, T handler);
[<System.Security.SecurityCritical>]
static member AddEventHandler : Func<'T, System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * 'T -> unit
static member AddEventHandler : Func<'T, System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> * 'T -> unit
Public Shared Sub AddEventHandler(Of T) (addMethod As Func(Of T, EventRegistrationToken), removeMethod As Action(Of EventRegistrationToken), handler As T)

Type Parameters

T

The type of the delegate that represents the event handler.

Parameters

addMethod
Func<T,EventRegistrationToken>

A delegate that represents the method that adds event handlers to the Windows Runtime event.

removeMethod
Action<EventRegistrationToken>

A delegate that represents the method that removes event handlers from the Windows Runtime event.

handler
T

A delegate the represents the event handler that is added.

Attributes

Exceptions

addMethod is null.

-or-

removeMethod is null.

Applies to