diff --git a/src/Avalonia.Base/Input/Gestures.cs b/src/Avalonia.Base/Input/Gestures.cs
index a924b391ac..a91e37177a 100644
--- a/src/Avalonia.Base/Input/Gestures.cs
+++ b/src/Avalonia.Base/Input/Gestures.cs
@@ -13,6 +13,18 @@ namespace Avalonia.Input
private static bool s_isHolding;
private static CancellationTokenSource? s_holdCancellationToken;
+ ///
+ /// Defines the IsHoldingEnabled attached property.
+ ///
+ public static readonly AttachedProperty IsHoldingEnabledProperty =
+ AvaloniaProperty.RegisterAttached("IsHoldingEnabled", typeof(Gestures), true);
+
+ ///
+ /// Defines the IsHoldWithMouseEnabled attached property.
+ ///
+ public static readonly AttachedProperty IsHoldWithMouseEnabledProperty =
+ AvaloniaProperty.RegisterAttached("IsHoldWithMouseEnabled", typeof(Gestures), false);
+
public static readonly RoutedEvent TappedEvent = RoutedEvent.Register(
"Tapped",
RoutingStrategies.Bubble,
@@ -75,6 +87,24 @@ namespace Avalonia.Input
RoutedEvent.Register(
"PullGestureEnded", RoutingStrategies.Bubble, typeof(Gestures));
+ public static bool GetIsHoldingEnabled(StyledElement element)
+ {
+ return element.GetValue(IsHoldingEnabledProperty);
+ }
+ public static void SetIsHoldingEnabled(StyledElement element, bool value)
+ {
+ element.SetValue(IsHoldingEnabledProperty, value);
+ }
+
+ public static bool GetIsHoldWithMouseEnabled(StyledElement element)
+ {
+ return element.GetValue(IsHoldWithMouseEnabledProperty);
+ }
+ public static void SetIsHoldWithMouseEnabled(StyledElement element, bool value)
+ {
+ element.SetValue(IsHoldWithMouseEnabledProperty, value);
+ }
+
static Gestures()
{
InputElement.PointerPressedEvent.RouteFinished.Subscribe(PointerPressed);
diff --git a/src/Avalonia.Base/Input/InputElement.cs b/src/Avalonia.Base/Input/InputElement.cs
index 4a65134552..e1835241bf 100644
--- a/src/Avalonia.Base/Input/InputElement.cs
+++ b/src/Avalonia.Base/Input/InputElement.cs
@@ -45,18 +45,6 @@ namespace Avalonia.Input
public static readonly StyledProperty CursorProperty =
AvaloniaProperty.Register(nameof(Cursor), null, true);
- ///
- /// Defines the property.
- ///
- public static readonly StyledProperty IsHoldingEnabledProperty =
- AvaloniaProperty.Register(nameof(IsHoldingEnabled), true);
-
- ///
- /// Defines the property.
- ///
- public static readonly StyledProperty IsHoldWithMouseEnabledProperty =
- AvaloniaProperty.Register(nameof(IsHoldWithMouseEnabled), false);
-
///
/// Defines the property.
///
@@ -209,7 +197,19 @@ namespace Avalonia.Input
/// Defines the event.
///
public static readonly RoutedEvent DoubleTappedEvent = Gestures.DoubleTappedEvent;
-
+
+ ///
+ /// Defines the property.
+ ///
+ public static readonly StyledProperty IsHoldingEnabledProperty =
+ Gestures.IsHoldingEnabledProperty.AddOwner();
+
+ ///
+ /// Defines the property.
+ ///
+ public static readonly StyledProperty IsHoldWithMouseEnabledProperty =
+ Gestures.IsHoldWithMouseEnabledProperty.AddOwner();
+
private bool _isEffectivelyEnabled = true;
private bool _isFocused;
private bool _isKeyboardFocusWithin;