Class SkiaSpinner
A wheel-of-names spinner control that displays items in a circular arrangement and allows spinning to select an item through gesture interaction.
[ContentProperty("ItemTemplate")]
public class SkiaSpinner : SkiaLayout, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISkiaGestureListener, IHasAfterEffects, ISkiaDisposable, ISkiaGridLayout, ISkiaLayout, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ILayoutInsideViewport, IInsideViewport, IVisibilityAware, IDisposable
- Inheritance
-
SkiaSpinner
- Implements
- Inherited Members
- Extension Methods
Constructors
SkiaSpinner()
public SkiaSpinner()
Fields
DecelerationProperty
public static readonly BindableProperty DecelerationProperty
Field Value
InContact
protected bool InContact
Field Value
InverseVisualRotationProperty
public static readonly BindableProperty InverseVisualRotationProperty
Field Value
IsUserPanning
protected bool IsUserPanning
Field Value
RespondsToGesturesProperty
public static readonly BindableProperty RespondsToGesturesProperty
Field Value
SelectedIndexProperty
public static readonly BindableProperty SelectedIndexProperty
Field Value
SelectionPositionProperty
public static readonly BindableProperty SelectionPositionProperty
Field Value
SnapProperty
public static readonly BindableProperty SnapProperty
Field Value
VelocityProperty
public static readonly BindableProperty VelocityProperty
Field Value
Wheel
protected SkiaWheelShape Wheel
Field Value
WheelRotationProperty
public static readonly BindableProperty WheelRotationProperty
Field Value
_flingAnimator
protected ScrollFlingAnimator _flingAnimator
Field Value
_rangeAnimator
protected RangeAnimator _rangeAnimator
Field Value
Properties
Deceleration
How much friction will be applied when rotating. Default is 0.0003. ///
public double Deceleration { get; set; }
Property Value
HadDown
public bool HadDown { get; protected set; }
Property Value
InverseVisualRotation
Controls the visual orientation direction. False = normal (readable at right), True = inverted (readable at left)
public bool InverseVisualRotation { get; set; }
Property Value
ItemTemplate
public DataTemplate ItemTemplate { get; set; }
Property Value
ItemsCount
protected int ItemsCount { get; }
Property Value
RespondsToGestures
If disabled will not scroll using gestures. Scrolling will still be possible by code.
public bool RespondsToGestures { get; set; }
Property Value
SelectedIndex
public int SelectedIndex { get; set; }
Property Value
SidePosition
Determines where on the wheel the selected item is calculated (Top, Right, Bottom, Left)
public SidePosition SidePosition { get; set; }
Property Value
Snap
Whether it should snap after scrolling stopped, default is True.
public bool Snap { get; set; }
Property Value
Velocity
How much the velocity in increased when rotating wheel using gestures. Default is 2.0.
public double Velocity { get; set; }
Property Value
WheelRotation
public double WheelRotation { get; set; }
Property Value
Methods
ApplyItemsSource()
Invalidate and re-apply ItemsSource
public override void ApplyItemsSource()
CreateWheel()
protected virtual SkiaWheelShape CreateWheel()
Returns
GetRotationForIndex(int)
Gets the rotation value needed to position a specific index at the selection position
public double GetRotationForIndex(int index)
Parameters
indexintTarget index
Returns
- double
Rotation value in degrees
GetSelectionPositionOffset()
Gets the angle offset for the current selection position
public double GetSelectionPositionOffset()
Returns
GetShortestRotationDistance(double, double)
Gets the shortest rotation distance from current rotation to target rotation
public double GetShortestRotationDistance(double currentRotation, double targetRotation)
Parameters
Returns
- double
Shortest rotation distance (can be negative for counterclockwise)
OnItemSourceChanged()
public override void OnItemSourceChanged()
OnItemsSourceCollectionChanged(object, NotifyCollectionChangedEventArgs)
Enhanced collection change handler with smart handling and fallback
protected override void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
Parameters
senderobjectargsNotifyCollectionChangedEventArgs
OnWillDisposeWithChildren()
The OnDisposing might come with a delay to avoid disposing resources at use. This method will be called without delay when Dispose() is invoked. Disposed will set to True and for Views their OnWillDisposeWithChildren will be called.
public override void OnWillDisposeWithChildren()
ProcessGestures(SkiaGesturesParameters, GestureEventProcessingInfo)
public override ISkiaGestureListener ProcessGestures(SkiaGesturesParameters args, GestureEventProcessingInfo apply)
Parameters
argsSkiaGesturesParametersapplyGestureEventProcessingInfo
Returns
ResetPan()
protected virtual void ResetPan()
Rotate(double, uint)
Animates the wheel to a specific rotation
public void Rotate(double targetRotation, uint durationMs = 500)
Parameters
SpinToIndex(int, int, uint)
Spins the wheel to a specific index with animation
public void SpinToIndex(int index, int spins = 0, uint speed = 350)
Parameters
indexintTarget index to spin to
spinsintNumber of extra full rotations (0 = direct spin)
speeduintAnimation duration in milliseconds
SpinToIndexShortest(int, uint)
Spins the wheel to a specific index with shortest path with animation
public void SpinToIndexShortest(int index, uint speed = 350)
Parameters
SpinToRandom()
Spins the wheel to a random position with animation
public void SpinToRandom()
StopScrolling()
public void StopScrolling()
Events
SelectedIndexChanged
public event EventHandler<int> SelectedIndexChanged