using Avalonia.Input; using Avalonia.Interactivity; namespace Avalonia.Xaml.Interactions.Events; /// /// /// public abstract class PointerPressedEventBehavior : InteractiveBehaviorBase { static PointerPressedEventBehavior() { RoutingStrategiesProperty.OverrideMetadata( new StyledPropertyMetadata( defaultValue: RoutingStrategies.Tunnel | RoutingStrategies.Bubble)); } /// protected override void OnAttachedToVisualTree() { AssociatedObject?.AddHandler(InputElement.PointerPressedEvent, PointerPressed, RoutingStrategies); } /// protected override void OnDetachedFromVisualTree() { AssociatedObject?.RemoveHandler(InputElement.PointerPressedEvent, PointerPressed); } private void PointerPressed(object? sender, PointerPressedEventArgs e) { OnPointerPressed(sender, e); } /// /// /// /// /// protected virtual void OnPointerPressed(object? sender, PointerPressedEventArgs e) { } }