|
|
@ -18,7 +18,7 @@ namespace Avalonia.Interactivity |
|
|
/// Gets the interactive parent of the object for bubbling and tunneling events.
|
|
|
/// Gets the interactive parent of the object for bubbling and tunneling events.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
IInteractive? IInteractive.InteractiveParent => ((IVisual)this).VisualParent as IInteractive; |
|
|
IInteractive? IInteractive.InteractiveParent => ((IVisual)this).VisualParent as IInteractive; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Adds a handler for the specified routed event.
|
|
|
/// Adds a handler for the specified routed event.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
@ -32,6 +32,25 @@ namespace Avalonia.Interactivity |
|
|
EventHandler<TEventArgs>? handler, |
|
|
EventHandler<TEventArgs>? handler, |
|
|
RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, |
|
|
RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, |
|
|
bool handledEventsToo = false) where TEventArgs : RoutedEventArgs |
|
|
bool handledEventsToo = false) where TEventArgs : RoutedEventArgs |
|
|
|
|
|
{ |
|
|
|
|
|
AddHandlerCore(routedEvent, handler, routes, handledEventsToo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void AddHandler( |
|
|
|
|
|
RoutedEvent routedEvent, |
|
|
|
|
|
EventHandler<RoutedEventArgs>? handler, |
|
|
|
|
|
RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, |
|
|
|
|
|
bool handledEventsToo = false) |
|
|
|
|
|
{ |
|
|
|
|
|
AddHandlerCore(routedEvent, handler, routes, handledEventsToo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void AddHandlerCore<TEventArgs>( |
|
|
|
|
|
RoutedEvent routedEvent, |
|
|
|
|
|
EventHandler<TEventArgs>? handler, |
|
|
|
|
|
RoutingStrategies routes = RoutingStrategies.Direct | RoutingStrategies.Bubble, |
|
|
|
|
|
bool handledEventsToo = false) where TEventArgs : RoutedEventArgs |
|
|
{ |
|
|
{ |
|
|
routedEvent = routedEvent ?? throw new ArgumentNullException(nameof(routedEvent)); |
|
|
routedEvent = routedEvent ?? throw new ArgumentNullException(nameof(routedEvent)); |
|
|
|
|
|
|
|
|
@ -50,6 +69,7 @@ namespace Avalonia.Interactivity |
|
|
|
|
|
|
|
|
AddEventSubscription(routedEvent, subscription); |
|
|
AddEventSubscription(routedEvent, subscription); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Removes a handler for the specified routed event.
|
|
|
/// Removes a handler for the specified routed event.
|
|
|
|