Table of Contents

Class SkiaButton

Namespace
DrawnUi.Draw
Assembly
DrawnUi.Maui.dll

Button-like control, can include any content inside. It's either you use default content (todo templates?..) or can include any content inside, and properties will by applied by convention to a SkiaLabel with Tag MainLabel, SkiaShape with Tag MainFrame. At the same time you can override ApplyProperties() and apply them to your content yourself. Convention elements tags: BtnText, BtnShape.

public class SkiaButton : SkiaLayout, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, IHasAfterEffects, ISkiaDisposable, ISkiaGridLayout, ISkiaLayout, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ILayoutInsideViewport, IInsideViewport, IVisibilityAware, IDisposable, ISkiaGestureListener
Inheritance
SkiaButton
Implements
Inherited Members
Extension Methods

Constructors

SkiaButton()

public SkiaButton()

SkiaButton(string)

public SkiaButton(string caption)

Parameters

caption string

Fields

ApplyEffectProperty

public static readonly BindableProperty ApplyEffectProperty

Field Value

BindableProperty

BevelProperty

public static readonly BindableProperty BevelProperty

Field Value

BindableProperty

BevelTypeProperty

public static readonly BindableProperty BevelTypeProperty

Field Value

BindableProperty

ButtonStyleProperty

public static readonly BindableProperty ButtonStyleProperty

Field Value

BindableProperty

Clicked

Occurs when the button is clicked/tapped (Tapped event).

public Action<SkiaButton, SkiaGesturesParameters> Clicked

Field Value

Action<SkiaButton, SkiaGesturesParameters>

CommandLongPressingParameterProperty

public static readonly BindableProperty CommandLongPressingParameterProperty

Field Value

BindableProperty

CommandLongPressingProperty

public static readonly BindableProperty CommandLongPressingProperty

Field Value

BindableProperty

CommandTappedParameterProperty

public static readonly BindableProperty CommandTappedParameterProperty

Field Value

BindableProperty

CommandTappedProperty

public static readonly BindableProperty CommandTappedProperty

Field Value

BindableProperty

CornerRadiusProperty

public static readonly BindableProperty CornerRadiusProperty

Field Value

BindableProperty

DelayCallbackMs

You might want to pause to show effect before executing command. Default is 0.

public static int DelayCallbackMs

Field Value

int

ElevationEnabledProperty

public static readonly BindableProperty ElevationEnabledProperty

Field Value

BindableProperty

FontFamilyProperty

public static readonly BindableProperty FontFamilyProperty

Field Value

BindableProperty

FontSizeProperty

public static readonly BindableProperty FontSizeProperty

Field Value

BindableProperty

IconPositionProperty

public static readonly BindableProperty IconPositionProperty

Field Value

BindableProperty

InitialBackground

protected Brush InitialBackground

Field Value

Brush

InitialBackgroundColor

protected Color InitialBackgroundColor

Field Value

Color

IsDisabledProperty

public static readonly BindableProperty IsDisabledProperty

Field Value

BindableProperty

IsPressedProperty

public static readonly BindableProperty IsPressedProperty

Field Value

BindableProperty

LockPanningProperty

public static readonly BindableProperty LockPanningProperty

Field Value

BindableProperty

MainFrame

public SkiaShape MainFrame

Field Value

SkiaShape

MainLabel

public SkiaLabel MainLabel

Field Value

SkiaLabel

MainWrapper

public SkiaLayout MainWrapper

Field Value

SkiaLayout

PanThreshold

public static float PanThreshold

Field Value

float

Pressed

Occurs when the button is pressed (Down event).

public Action<SkiaButton, SkiaGesturesParameters> Pressed

Field Value

Action<SkiaButton, SkiaGesturesParameters>

Released

Occurs when the button is released (Up event).

public Action<SkiaButton, SkiaGesturesParameters> Released

Field Value

Action<SkiaButton, SkiaGesturesParameters>

ShimmerEffectAngleProperty

public static readonly BindableProperty ShimmerEffectAngleProperty

Field Value

BindableProperty

ShimmerEffectColorProperty

public static readonly BindableProperty ShimmerEffectColorProperty

Field Value

BindableProperty

ShimmerEffectSpeedProperty

public static readonly BindableProperty ShimmerEffectSpeedProperty

Field Value

BindableProperty

ShimmerEffectWidthProperty

public static readonly BindableProperty ShimmerEffectWidthProperty

Field Value

BindableProperty

StrokeColorProperty

public static readonly BindableProperty StrokeColorProperty

Field Value

BindableProperty

StrokeWidthProperty

public static readonly BindableProperty StrokeWidthProperty

Field Value

BindableProperty

TextCaseProperty

public static readonly BindableProperty TextCaseProperty

Field Value

BindableProperty

TextColorProperty

public static readonly BindableProperty TextColorProperty

Field Value

BindableProperty

TextProperty

public static readonly BindableProperty TextProperty

Field Value

BindableProperty

TextStrokeColorProperty

public static readonly BindableProperty TextStrokeColorProperty

Field Value

BindableProperty

_lastDownPts

protected SKPoint _lastDownPts

Field Value

SKPoint

Properties

ApplyEffect

public SkiaTouchAnimation ApplyEffect { get; set; }

Property Value

SkiaTouchAnimation

Bevel

public SkiaBevel Bevel { get; set; }

Property Value

SkiaBevel

BevelType

public BevelType BevelType { get; set; }

Property Value

BevelType

ButtonPadding

protected Thickness ButtonPadding { get; set; }

Property Value

Thickness

ButtonStyle

Gets or sets the style variant of the button (Contained, Outlined, or Text).

public SkiaButton.ButtonStyleType ButtonStyle { get; set; }

Property Value

SkiaButton.ButtonStyleType

CommandLongPressing

public ICommand CommandLongPressing { get; set; }

Property Value

ICommand

CommandLongPressingParameter

public object CommandLongPressingParameter { get; set; }

Property Value

object

CommandTapped

public ICommand CommandTapped { get; set; }

Property Value

ICommand

CommandTappedParameter

public object CommandTappedParameter { get; set; }

Property Value

object

CornerRadius

[TypeConverter(typeof(CornerRadiusTypeConverter))]
public CornerRadius CornerRadius { get; set; }

Property Value

CornerRadius

ElevationEnabled

Gets or sets whether the button has elevation (shadow effect).

public bool ElevationEnabled { get; set; }

Property Value

bool

FontFamily

public string FontFamily { get; set; }

Property Value

string

FontSize

public double FontSize { get; set; }

Property Value

double

IconPosition

Gets or sets the position of the icon relative to the button text.

public SkiaButton.IconPositionType IconPosition { get; set; }

Property Value

SkiaButton.IconPositionType

IsDisabled

public bool IsDisabled { get; set; }

Property Value

bool

IsPressed

Gets whether the button is pressed, readonly.

public bool IsPressed { get; set; }

Property Value

bool

LockPanning

public bool LockPanning { get; set; }

Property Value

bool

ShimmerEffectAngle

public float ShimmerEffectAngle { get; set; }

Property Value

float

ShimmerEffectColor

public Color ShimmerEffectColor { get; set; }

Property Value

Color

ShimmerEffectSpeed

public int ShimmerEffectSpeed { get; set; }

Property Value

int

ShimmerEffectWidth

public float ShimmerEffectWidth { get; set; }

Property Value

float

StrokeColor

public Color StrokeColor { get; set; }

Property Value

Color

StrokeWidth

public float StrokeWidth { get; set; }

Property Value

float

Text

Bind to your own content!

public string Text { get; set; }

Property Value

string

TextCase

Gets or sets how the button text case is transformed (None, Uppercase, Lowercase).

public TextTransform TextCase { get; set; }

Property Value

TextTransform

TextColor

public Color TextColor { get; set; }

Property Value

Color

TextStrokeColor

public Color TextStrokeColor { get; set; }

Property Value

Color

TotalDown

public long TotalDown { get; set; }

Property Value

long

TotalTapped

public long TotalTapped { get; set; }

Property Value

long

Methods

ApplyProperties()

public virtual void ApplyProperties()

CreateClip(object, bool, SKPath)

Clip effects with rounded rect of the frame inside

public override SKPath CreateClip(object arguments, bool usePosition, SKPath path = null)

Parameters

arguments object
usePosition bool
path SKPath

Returns

SKPath

CreateCupertinoStyleContent()

protected virtual void CreateCupertinoStyleContent()

CreateDefaultContent()

protected override void CreateDefaultContent()

CreateDefaultStyleContent()

protected virtual void CreateDefaultStyleContent()

CreateElevation()

protected virtual SkiaButton.ButtonElevationShadowEffect CreateElevation()

Returns

SkiaButton.ButtonElevationShadowEffect

CreateMaterialStyleContent()

protected virtual void CreateMaterialStyleContent()

CreateWindowsStyleContent()

protected virtual void CreateWindowsStyleContent()

FindViews()

public virtual void FindViews()

IsInsideTapRegion(SkiaGesturesParameters)

protected virtual bool IsInsideTapRegion(SkiaGesturesParameters parameters)

Parameters

parameters SkiaGesturesParameters

Returns

bool

OnButtonPropertyChanged(SkiaButton, string)

protected virtual void OnButtonPropertyChanged(SkiaButton control, string propertyName)

Parameters

control SkiaButton
propertyName string

OnChildrenChanged()

Happens when child was added or removed, will call Invalidate() in base

public override void OnChildrenChanged()

OnDisposing()

Base performs some cleanup actions with Superview

public override void OnDisposing()

OnDown(SkiaGesturesParameters, GestureEventProcessingInfo)

public virtual bool OnDown(SkiaGesturesParameters args, GestureEventProcessingInfo apply)

Parameters

args SkiaGesturesParameters
apply GestureEventProcessingInfo

Returns

bool

OnPaddingSet(Thickness)

Can override this for custom controls to apply padding differently from the default way

public override Thickness OnPaddingSet(Thickness padding)

Parameters

padding Thickness

Returns

Thickness

OnPropertyChanged(string)

Method that is called when a bound property is changed.

protected override void OnPropertyChanged(string propertyName = null)

Parameters

propertyName string

The name of the bound property that changed.

OnTapped(SkiaGesturesParameters, SKPoint)

public virtual bool OnTapped(SkiaGesturesParameters args, SKPoint childOffset)

Parameters

args SkiaGesturesParameters
childOffset SKPoint

Returns

bool

OnUp(SkiaGesturesParameters, GestureEventProcessingInfo)

public virtual void OnUp(SkiaGesturesParameters args, GestureEventProcessingInfo apply)

Parameters

args SkiaGesturesParameters
apply GestureEventProcessingInfo

ProcessGestures(SkiaGesturesParameters, GestureEventProcessingInfo)

public override ISkiaGestureListener ProcessGestures(SkiaGesturesParameters args, GestureEventProcessingInfo apply)

Parameters

args SkiaGesturesParameters
apply GestureEventProcessingInfo

Returns

ISkiaGestureListener

SetupBackgroundPaint(SKPaint, SKRect)

Will never paint background, it's up to the button shape to do it.

protected override bool SetupBackgroundPaint(SKPaint paint, SKRect destination)

Parameters

paint SKPaint
destination SKRect

Returns

bool

Events

Down

public event EventHandler<SkiaGesturesParameters> Down

Event Type

EventHandler<SkiaGesturesParameters>

Up

public event EventHandler<SkiaGesturesParameters> Up

Event Type

EventHandler<SkiaGesturesParameters>