RightTappedEventBehavior.cs 887 B

123456789101112131415161718192021222324252627282930313233343536
  1. using Avalonia.Input;
  2. using Avalonia.Interactivity;
  3. namespace Avalonia.Xaml.Interactions.Events;
  4. /// <summary>
  5. ///
  6. /// </summary>
  7. public abstract class RightTappedEventBehavior : InteractiveBehaviorBase
  8. {
  9. /// <inheritdoc />
  10. protected override void OnAttachedToVisualTree()
  11. {
  12. AssociatedObject?.AddHandler(Gestures.RightTappedEvent, RightTapped, RoutingStrategies);
  13. }
  14. /// <inheritdoc />
  15. protected override void OnDetachedFromVisualTree()
  16. {
  17. AssociatedObject?.RemoveHandler(Gestures.RightTappedEvent, RightTapped);
  18. }
  19. private void RightTapped(object? sender, RoutedEventArgs e)
  20. {
  21. OnRightTapped(sender, e);
  22. }
  23. /// <summary>
  24. ///
  25. /// </summary>
  26. /// <param name="sender"></param>
  27. /// <param name="e"></param>
  28. protected virtual void OnRightTapped(object? sender, RoutedEventArgs e)
  29. {
  30. }
  31. }