Table of Contents

Class SkiaMauiElement

Namespace
DrawnUi.Draw
Assembly
DrawnUi.Maui.dll
[ContentProperty("Content")]
public class SkiaMauiElement : SkiaControl, INotifyPropertyChanged, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, IVisualElementController, IElementController, IView, ITransform, IElement, IVisualTreeElement, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISkiaGestureListener, IHasAfterEffects, ISkiaControl, IDrawnBase, ICanBeUpdatedWithContext, ICanBeUpdated, ISkiaDisposable, IDisposable
Inheritance
SkiaMauiElement
Implements
Derived
Inherited Members
Extension Methods

Fields

AnimateSnapshotProperty

public static readonly BindableProperty AnimateSnapshotProperty

Field Value

BindableProperty

ContentProperty

public static readonly BindableProperty ContentProperty

Field Value

BindableProperty

ContentSizeUnits

protected Size ContentSizeUnits

Field Value

Size

FreezeTimeMsProperty

public static readonly BindableProperty FreezeTimeMsProperty

Field Value

BindableProperty

TimerShowMauiView

protected RestartingTimer<object> TimerShowMauiView

Field Value

RestartingTimer<object>

Properties

AnimateSnapshot

Set to true if you are hosting the control inside a scroll or similar case where the control position/transforms are animated fast.

public bool AnimateSnapshot { get; set; }

Property Value

bool

CacheSurfaceInfo

public SKImageInfo CacheSurfaceInfo { get; set; }

Property Value

SKImageInfo

CachedBitmap

public SKSurface CachedBitmap { get; protected set; }

Property Value

SKSurface

Content

Gets or sets the native MAUI VisualElement to embed within the DrawnUI canvas. This can be any MAUI control like WebView, MediaElement, Entry, Picker, etc. The control will be rendered using platform-specific optimizations.

public VisualElement Content { get; set; }

Property Value

VisualElement

Element

Maui Element to be rendered

public VisualElement Element { get; protected set; }

Property Value

VisualElement

ElementSize

PIXELS, for faster checks

public SKPoint ElementSize { get; set; }

Property Value

SKPoint

FreezeTimeMs

public int FreezeTimeMs { get; set; }

Property Value

int

IsNativeVisible

public bool IsNativeVisible { get; protected set; }

Property Value

bool

NeedsLayoutNative

public bool NeedsLayoutNative { get; set; }

Property Value

bool

ShowSnapshot

public bool ShowSnapshot { get; }

Property Value

bool

VisualTransformNative

public VisualTransformNative VisualTransformNative { get; protected set; }

Property Value

VisualTransformNative

WasRendered

public bool WasRendered { get; protected set; }

Property Value

bool

Methods

ApplyTransform(VisualTransform)

public void ApplyTransform(VisualTransform transform)

Parameters

transform VisualTransform

CheckChildAdded()

protected virtual void CheckChildAdded()

CreateMauiElement(VisualElement)

public void CreateMauiElement(VisualElement element)

Parameters

element VisualElement

GetVisualChildren()

For HotReload

public override IReadOnlyList<IVisualTreeElement> GetVisualChildren()

Returns

IReadOnlyList<IVisualTreeElement>

LayoutMauiElement(bool)

public void LayoutMauiElement(bool manageMainThread = true)

Parameters

manageMainThread bool

LayoutNativeView(VisualElement)

protected virtual void LayoutNativeView(VisualElement element)

Parameters

element VisualElement

MeasureAbsolute(SKRect, float)

Measure children inside absolute layout

public override ScaledSize MeasureAbsolute(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

MeasureAndArrangeMauiElement(double, double)

Measure and arrange VisualElement using Maui methods

public virtual Size MeasureAndArrangeMauiElement(double ptsWidth, double ptsHeight)

Parameters

ptsWidth double
ptsHeight double

Returns

Size

NativeInvalidate()

public void NativeInvalidate()

OnBindingContextChanged()

First Maui will apply bindings to your controls, then it would call OnBindingContextChanged, so beware on not to break bindings.

protected override void OnBindingContextChanged()

OnChildAdded(SkiaControl)

Prevent usage of subviews as we are using Content property for this control

public override void OnChildAdded(SkiaControl child)

Parameters

child SkiaControl

OnDisposing()

Base performs some cleanup actions with Superview

public override void OnDisposing()

OnFirstDrawn()

protected override void OnFirstDrawn()

OnLayoutChanged()

DrawingRect size changed

protected override void OnLayoutChanged()

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

PostponeShowingNativeView(int)

protected void PostponeShowingNativeView(int ms)

Parameters

ms int

Refresh()

public void Refresh()

Render(DrawingContext)

public override void Render(DrawingContext context)

Parameters

context DrawingContext

SetChildren(IEnumerable<SkiaControl>)

Prevent usage of subviews as we are using Content property for this control

public override void SetChildren(IEnumerable<SkiaControl> views)

Parameters

views IEnumerable<SkiaControl>

SetContent(VisualElement)

Use Content property for direct access

protected virtual void SetContent(VisualElement view)

Parameters

view VisualElement

SetNativeVisibility(bool)

public virtual void SetNativeVisibility(bool state)

Parameters

state bool

SetVisualTransform(VisualTransform)

Comes after all drawn, actually used by SkiaMauiElement only

public override void SetVisualTransform(VisualTransform transform)

Parameters

transform VisualTransform

SubscribeToRenderingChain(bool)

protected void SubscribeToRenderingChain(bool subscribe)

Parameters

subscribe bool

SuperViewChanged()

public override void SuperViewChanged()