AddDisposableHandler<TEventArgs> Method
Adds a handler for the specified routed event and returns a disposable that can terminate the event subscription.
Definition
Namespace: Avalonia.Interactivity
Assembly: Avalonia.Base (in Avalonia.Base.dll)
- C#
- VB
- F#
public static IDisposable AddDisposableHandler<TEventArgs>(
this Interactive o,
RoutedEvent<TEventArgs> routedEvent,
EventHandler<TEventArgs> handler,
RoutingStrategies routes = RoutingStrategies.Direct|RoutingStrategies.Bubble,
bool handledEventsToo = false
)
where TEventArgs : RoutedEventArgs
<ExtensionAttribute>
Public Shared Function AddDisposableHandler(Of TEventArgs As RoutedEventArgs) (
o As Interactive,
routedEvent As RoutedEvent(Of TEventArgs),
handler As EventHandler(Of TEventArgs),
Optional routes As RoutingStrategies = RoutingStrategies.Direct Or RoutingStrategies.Bubble,
Optional handledEventsToo As Boolean = false
) As IDisposable
[<ExtensionAttribute>]
static member AddDisposableHandler :
o : Interactive *
routedEvent : RoutedEvent<'TEventArgs> *
handler : EventHandler<'TEventArgs> *
?routes : RoutingStrategies *
?handledEventsToo : bool
(* Defaults:
let _routes = defaultArg routes RoutingStrategies.Direct|RoutingStrategies.Bubble
let _handledEventsToo = defaultArg handledEventsToo false
*)
-> IDisposable when 'TEventArgs : RoutedEventArgs
Parameters
- Interactive
- Target for adding given event handler.
- RoutedEvent(TEventArgs)
- The routed event.
- EventHandler(TEventArgs)
- The handler.
- RoutingStrategies (Optional)
- The routing strategies to listen to.
- Boolean (Optional)
- Whether handled events should also be listened for.
Type Parameters
- The type of the event's args.
Return Value
IDisposable
A disposable that terminates the event subscription.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Interactive. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also
Reference
InteractiveExtensions Class
Avalonia.Interactivity Namespace