Table of Contents

Class SkiaSpinner

Namespace
DrawnUi.Controls
Assembly
DrawnUi.Maui.dll

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

BindableProperty

InContact

protected bool InContact

Field Value

bool

InverseVisualRotationProperty

public static readonly BindableProperty InverseVisualRotationProperty

Field Value

BindableProperty

IsUserPanning

protected bool IsUserPanning

Field Value

bool

RespondsToGesturesProperty

public static readonly BindableProperty RespondsToGesturesProperty

Field Value

BindableProperty

SelectedIndexProperty

public static readonly BindableProperty SelectedIndexProperty

Field Value

BindableProperty

SelectionPositionProperty

public static readonly BindableProperty SelectionPositionProperty

Field Value

BindableProperty

SnapProperty

public static readonly BindableProperty SnapProperty

Field Value

BindableProperty

VelocityProperty

public static readonly BindableProperty VelocityProperty

Field Value

BindableProperty

Wheel

protected SkiaWheelShape Wheel

Field Value

SkiaWheelShape

WheelRotationProperty

public static readonly BindableProperty WheelRotationProperty

Field Value

BindableProperty

_flingAnimator

protected ScrollFlingAnimator _flingAnimator

Field Value

ScrollFlingAnimator

_rangeAnimator

protected RangeAnimator _rangeAnimator

Field Value

RangeAnimator

Properties

Deceleration

How much friction will be applied when rotating. Default is 0.0003. ///

public double Deceleration { get; set; }

Property Value

double

HadDown

public bool HadDown { get; protected set; }

Property Value

bool

InverseVisualRotation

Controls the visual orientation direction. False = normal (readable at right), True = inverted (readable at left)

public bool InverseVisualRotation { get; set; }

Property Value

bool

ItemTemplate

public DataTemplate ItemTemplate { get; set; }

Property Value

DataTemplate

ItemsCount

protected int ItemsCount { get; }

Property Value

int

RespondsToGestures

If disabled will not scroll using gestures. Scrolling will still be possible by code.

public bool RespondsToGestures { get; set; }

Property Value

bool

SelectedIndex

public int SelectedIndex { get; set; }

Property Value

int

SidePosition

Determines where on the wheel the selected item is calculated (Top, Right, Bottom, Left)

public SidePosition SidePosition { get; set; }

Property Value

SidePosition

Snap

Whether it should snap after scrolling stopped, default is True.

public bool Snap { get; set; }

Property Value

bool

Velocity

How much the velocity in increased when rotating wheel using gestures. Default is 2.0.

public double Velocity { get; set; }

Property Value

double

WheelRotation

public double WheelRotation { get; set; }

Property Value

double

Methods

ApplyItemsSource()

Invalidate and re-apply ItemsSource

public override void ApplyItemsSource()

CreateWheel()

protected virtual SkiaWheelShape CreateWheel()

Returns

SkiaWheelShape

GetRotationForIndex(int)

Gets the rotation value needed to position a specific index at the selection position

public double GetRotationForIndex(int index)

Parameters

index int

Target index

Returns

double

Rotation value in degrees

GetSelectionPositionOffset()

Gets the angle offset for the current selection position

public double GetSelectionPositionOffset()

Returns

double

GetShortestRotationDistance(double, double)

Gets the shortest rotation distance from current rotation to target rotation

public double GetShortestRotationDistance(double currentRotation, double targetRotation)

Parameters

currentRotation double

Current wheel rotation

targetRotation double

Target rotation

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

sender object
args NotifyCollectionChangedEventArgs

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

args SkiaGesturesParameters
apply GestureEventProcessingInfo

Returns

ISkiaGestureListener

ResetPan()

protected virtual void ResetPan()

Rotate(double, uint)

Animates the wheel to a specific rotation

public void Rotate(double targetRotation, uint durationMs = 500)

Parameters

targetRotation double
durationMs uint

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

index int

Target index to spin to

spins int

Number of extra full rotations (0 = direct spin)

speed uint

Animation 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

index int

Target index to spin to

speed uint

Animation duration in milliseconds

SpinToRandom()

Spins the wheel to a random position with animation

public void SpinToRandom()

StopScrolling()

public void StopScrolling()

Events

SelectedIndexChanged

public event EventHandler<int> SelectedIndexChanged

Event Type

EventHandler<int>