Table of Contents

Class SnappingLayout

Namespace
DrawnUi.Draw
Assembly
DrawnUi.Maui.dll
public class SnappingLayout : 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
SnappingLayout
Implements
Derived
Inherited Members
Extension Methods

Fields

AnimatedProperty

public static readonly BindableProperty AnimatedProperty

Field Value

BindableProperty

AnimatorRange

protected RangeVectorAnimator AnimatorRange

Field Value

RangeVectorAnimator

AutoVelocityMultiplyPtsProperty

public static readonly BindableProperty AutoVelocityMultiplyPtsProperty

Field Value

BindableProperty

BouncesProperty

public static readonly BindableProperty BouncesProperty

Field Value

BindableProperty

IgnoreWrongDirectionProperty

public static readonly BindableProperty IgnoreWrongDirectionProperty

Field Value

BindableProperty

InTransitionProperty

public static readonly BindableProperty InTransitionProperty

Field Value

BindableProperty

RespondsToGesturesProperty

public static readonly BindableProperty RespondsToGesturesProperty

Field Value

BindableProperty

RubberDampingProperty

public static readonly BindableProperty RubberDampingProperty

Field Value

BindableProperty

RubberEffectProperty

public static readonly BindableProperty RubberEffectProperty

Field Value

BindableProperty

TransitionDirectionProperty

public static readonly BindableProperty TransitionDirectionProperty

Field Value

BindableProperty

VectorAnimatorSpring

protected SpringWithVelocityVectorAnimator VectorAnimatorSpring

Field Value

SpringWithVelocityVectorAnimator

Properties

Animated

public bool Animated { get; set; }

Property Value

bool

AutoVelocityMultiplyPts

If velocity is near 0 define how much we multiply the auto-velocity used to animate snappoing point. For example when in carousel you cancel the swipe and release finger..

public double AutoVelocityMultiplyPts { get; set; }

Property Value

double

Bounces

public bool Bounces { get; set; }

Property Value

bool

CanAnimate

public virtual bool CanAnimate { get; }

Property Value

bool

ContentOffsetBounds

There are the bounds the scroll offset can go to.. This are NOT the bounds of the whole content.

protected SKRect ContentOffsetBounds { get; set; }

Property Value

SKRect

CurrentPosition

public Vector2 CurrentPosition { get; protected set; }

Property Value

Vector2

CurrentSnap

protected Vector2 CurrentSnap { get; set; }

Property Value

Vector2

IgnoreWrongDirection

Will ignore gestures of the wrong direction, like if this Orientation is Horizontal will ignore gestures with vertical direction velocity

public bool IgnoreWrongDirection { get; set; }

Property Value

bool

InTransition

public bool InTransition { get; set; }

Property Value

bool

RespondsToGestures

Can be open/closed by gestures along with code-behind, default is true

public bool RespondsToGestures { get; set; }

Property Value

bool

RubberDamping

If Bounce is enabled this basically controls how less the scroll will bounce when displaced from limit by finger or inertia. Default is 0.8.

public double RubberDamping { get; set; }

Property Value

double

RubberEffect

If Bounce is enabled this basically controls how far from the limit can the scroll be elastically offset by finger or inertia. Default is 0.15.

public double RubberEffect { get; set; }

Property Value

double

ScrollLocked

protected bool ScrollLocked { get; set; }

Property Value

bool

SnapDistanceRatio

0.2 - Part of the distance between snap points the velocity need to cover to trigger going to the next snap point. NOT a bindable property (yet).

public double SnapDistanceRatio { get; set; }

Property Value

double

SnapPoints

public IList<Vector2> SnapPoints { get; set; }

Property Value

IList<Vector2>

TransitionDirection

public LinearDirectionType TransitionDirection { get; set; }

Property Value

LinearDirectionType

Viewport

Using this instead of RenderingViewport

protected SKRect Viewport { get; set; }

Property Value

SKRect

Methods

ApplyOptions(bool)

public virtual void ApplyOptions(bool initialize)

Parameters

initialize bool

ApplyPosition(Vector2)

public virtual void ApplyPosition(Vector2 position)

Parameters

position Vector2

CheckTransitionEnded()

public virtual bool CheckTransitionEnded()

Returns

bool

ClampOffset(float, float, bool)

public virtual Vector2 ClampOffset(float x, float y, bool rubber)

Parameters

x float
y float
rubber bool

Returns

Vector2

ClampOffsetWithRubberBand(float, float)

Called for manual finger panning

protected virtual Vector2 ClampOffsetWithRubberBand(float x, float y)

Parameters

x float
y float

Returns

Vector2

FindNearestAnchor(Vector2)

public virtual Vector2 FindNearestAnchor(Vector2 current)

Parameters

current Vector2

Returns

Vector2

FindNearestAnchorInternal(Vector2, Vector2)

protected virtual Vector2 FindNearestAnchorInternal(Vector2 current, Vector2 velocity)

Parameters

current Vector2
velocity Vector2

Returns

Vector2

GetAutoVelocity(Vector2)

todo calc upon measured size + prop for speed

protected virtual Vector2 GetAutoVelocity(Vector2 displacement)

Parameters

displacement Vector2

Returns

Vector2

GetContentOffsetBounds()

There are the bounds the scroll offset can go to.. This are NOT the bounds of the whole content.

public virtual SKRect GetContentOffsetBounds()

Returns

SKRect

NeedApplyOptions(BindableObject, object, object)

protected static void NeedApplyOptions(BindableObject bindable, object oldvalue, object newvalue)

Parameters

bindable BindableObject
oldvalue object
newvalue object

OnTransitionChanged()

Invokes TransitionChanged event

public virtual void OnTransitionChanged()

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()

Render(DrawingContext)

public override void Render(DrawingContext context)

Parameters

context DrawingContext

ScrollToNearestAnchor(Vector2, Vector2)

public virtual void ScrollToNearestAnchor(Vector2 location, Vector2 velocity)

Parameters

location Vector2
velocity Vector2

ScrollToOffset(Vector2, Vector2, bool)

protected virtual bool ScrollToOffset(Vector2 targetOffset, Vector2 velocity, bool animate)

Parameters

targetOffset Vector2
velocity Vector2
animate bool

Returns

bool

SelectNextAnchor(Vector2, Vector2)

Return an anchor depending on direction and strength of of the velocity

public virtual Vector2 SelectNextAnchor(Vector2 origin, Vector2 velocity)

Parameters

origin Vector2
velocity Vector2

Returns

Vector2

SendScrolled()

public virtual void SendScrolled()

UpdateReportedPosition()

public virtual void UpdateReportedPosition()

Events

Scrolled

public event EventHandler<Vector2> Scrolled

Event Type

EventHandler<Vector2>

TransitionChanged

public event EventHandler<bool> TransitionChanged

Event Type

EventHandler<bool>

ViewportReady

public event EventHandler ViewportReady

Event Type

EventHandler