SwipeGestureRecognizer Class
Definition
A gesture recognizer that detects swipe gestures for paging interactions.
public class SwipeGestureRecognizer
Remarks
Unlike Avalonia.Input.GestureRecognizers.ScrollGestureRecognizer, this recognizer is optimized for discrete paging interactions (e.g., carousel navigation) rather than continuous scrolling. It does not include inertia or friction physics.
Constructors
| Name | Description |
|---|---|
| SwipeGestureRecognizer | No summary available. |
SwipeGestureRecognizer Constructor
public SwipeGestureRecognizer()
Methods
| Name | Description |
|---|---|
| ApplyStyling | Applies styling to the control if the control is initialized and styling is not already applied. Inherited from StyledElement. |
| BeginInit | Inherited from StyledElement. |
| EndInit | Inherited from StyledElement. |
| TryGetResource | Inherited from StyledElement. |
| Bind (8 overloads) | Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject. |
| CheckAccess | Returns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject. |
| ClearValue (4 overloads) | Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject. |
| CoerceValue | Coerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject. |
| Equals | Compares two objects using reference equality. Inherited from AvaloniaObject. |
| GetBaseValue | Inherited from AvaloniaObject. |
| GetHashCode | Gets the hash code for the object. Inherited from AvaloniaObject. |
| GetValue (3 overloads) | Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject. |
| IsAnimating | Checks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject. |
| IsSet | Checks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject. |
| SetCurrentValue (2 overloads) | Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject. |
| SetValue (3 overloads) | Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject. |
| VerifyAccess | Checks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject. |
Properties
| Name | Description |
|---|---|
| CanHorizontallySwipe | Gets or sets a value indicating whether horizontal swipes are tracked. |
| CanVerticallySwipe | Gets or sets a value indicating whether vertical swipes are tracked. |
| IsEnabled | Gets or sets a value indicating whether this recognizer responds to pointer events. Defaults to . |
| IsMouseEnabled | Gets or sets a value indicating whether mouse pointer events trigger swipe gestures. Defaults to ; touch and pen are always enabled. |
| Threshold | Gets or sets the minimum pointer movement in pixels before a swipe is recognized. A value of 0 reads the threshold from Avalonia.Platform.IPlatformSettings at gesture time. |
| ActualThemeVariant | Gets the UI theme that is currently used by the element, which might be different than the RequestedThemeVariantProperty. Inherited from StyledElement. |
| Classes | Gets or sets the styled element's classes. Inherited from StyledElement. |
| DataContext | Gets or sets the control's data context. Inherited from StyledElement. |
| IsInitialized | Gets a value that indicates whether the element has finished initialization. Inherited from StyledElement. |
| Name | Gets or sets the name of the styled element. Inherited from StyledElement. |
| Parent | Gets the styled element's logical parent. Inherited from StyledElement. |
| Resources | Gets or sets the styled element's resource dictionary. Inherited from StyledElement. |
| StyleKey | Gets the type by which the element is styled. Inherited from StyledElement. |
| Styles | Gets the styles for the styled element. Inherited from StyledElement. |
| TemplatedParent | Gets the styled element whose lookless template this styled element is part of. Inherited from StyledElement. |
| Theme | Gets or sets the theme to be applied to the element. Inherited from StyledElement. |
| Transitions | Gets or sets the property transitions for the control. Inherited from Animatable. |
| Dispatcher | Returns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject. |
| Item | Inherited from AvaloniaObject. |
CanHorizontallySwipe Property
Gets or sets a value indicating whether horizontal swipes are tracked.
public bool CanHorizontallySwipe { get; set; }
CanVerticallySwipe Property
Gets or sets a value indicating whether vertical swipes are tracked.
public bool CanVerticallySwipe { get; set; }
IsEnabled Property
Gets or sets a value indicating whether this recognizer responds to pointer events. Defaults to .
public bool IsEnabled { get; set; }
IsMouseEnabled Property
Gets or sets a value indicating whether mouse pointer events trigger swipe gestures. Defaults to ; touch and pen are always enabled.
public bool IsMouseEnabled { get; set; }
Threshold Property
Gets or sets the minimum pointer movement in pixels before a swipe is recognized. A value of 0 reads the threshold from Avalonia.Platform.IPlatformSettings at gesture time.
public double Threshold { get; set; }
Fields
CanHorizontallySwipeProperty Field
Defines the Avalonia.Input.GestureRecognizers.SwipeGestureRecognizer.CanHorizontallySwipe property.
public Avalonia.StyledProperty<TValue><bool> CanHorizontallySwipeProperty
CanVerticallySwipeProperty Field
Defines the Avalonia.Input.GestureRecognizers.SwipeGestureRecognizer.CanVerticallySwipe property.
public Avalonia.StyledProperty<TValue><bool> CanVerticallySwipeProperty
IsEnabledProperty Field
Defines the Avalonia.Input.GestureRecognizers.SwipeGestureRecognizer.IsEnabled property.
public Avalonia.StyledProperty<TValue><bool> IsEnabledProperty
IsMouseEnabledProperty Field
Defines the Avalonia.Input.GestureRecognizers.SwipeGestureRecognizer.IsMouseEnabled property.
public Avalonia.StyledProperty<TValue><bool> IsMouseEnabledProperty
ThresholdProperty Field
Defines the Avalonia.Input.GestureRecognizers.SwipeGestureRecognizer.Threshold property.
public Avalonia.StyledProperty<TValue><double> ThresholdProperty
Remarks
A value of 0 (the default) causes the distance to be read from Avalonia.Platform.IPlatformSettings at the time of the first gesture.
Events
| Name | Description |
|---|---|
| ActualThemeVariantChanged | Raised when the theme variant is changed on the element or an ancestor of the element. Inherited from StyledElement. |
| AttachedToLogicalTree | Raised when the styled element is attached to a rooted logical tree. Inherited from StyledElement. |
| DataContextChanged | Occurs when the Avalonia.StyledElement.DataContext property changes. Inherited from StyledElement. |
| DetachedFromLogicalTree | Raised when the styled element is detached from a rooted logical tree. Inherited from StyledElement. |
| Initialized | Occurs when the styled element has finished initialization. Inherited from StyledElement. |
| ResourcesChanged | Occurs when a resource in this styled element or a parent styled element has changed. Inherited from StyledElement. |
| PropertyChanged | Raised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject. |