Table of Contents

Class SkiaLayout

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

Constructors

SkiaLayout()

public SkiaLayout()

Fields

ColumnDefinitionsProperty

public static readonly BindableProperty ColumnDefinitionsProperty

Field Value

BindableProperty

ColumnSpacingProperty

public static readonly BindableProperty ColumnSpacingProperty

Field Value

BindableProperty

DefaultColumnDefinitionProperty

public static readonly BindableProperty DefaultColumnDefinitionProperty

Field Value

BindableProperty

DefaultRowDefinitionProperty

public static readonly BindableProperty DefaultRowDefinitionProperty

Field Value

BindableProperty

DynamicColumnsProperty

public static readonly BindableProperty DynamicColumnsProperty

Field Value

BindableProperty

EmptyViewProperty

public static readonly BindableProperty EmptyViewProperty

Field Value

BindableProperty

GridStructure

public SkiaLayout.SkiaGridStructure GridStructure

Field Value

SkiaLayout.SkiaGridStructure

GridStructureMeasured

public SkiaLayout.SkiaGridStructure GridStructureMeasured

Field Value

SkiaLayout.SkiaGridStructure

InvertProperty

public static readonly BindableProperty InvertProperty

Field Value

BindableProperty

ItemTemplatePoolSizeProperty

public static readonly BindableProperty ItemTemplatePoolSizeProperty

Field Value

BindableProperty

ItemsSourceProperty

public static readonly BindableProperty ItemsSourceProperty

Field Value

BindableProperty

LineBreaks

protected List<int> LineBreaks

Field Value

List<int>

MeasureItemsStrategyProperty

public static readonly BindableProperty MeasureItemsStrategyProperty

Field Value

BindableProperty

MeasureStamp

protected long MeasureStamp

Field Value

long

RecyclingBufferProperty

public static readonly BindableProperty RecyclingBufferProperty

Field Value

BindableProperty

RecyclingTemplateProperty

public static readonly BindableProperty RecyclingTemplateProperty

Field Value

BindableProperty

ReserveTemplatesProperty

public static readonly BindableProperty ReserveTemplatesProperty

Field Value

BindableProperty

RowDefinitionsProperty

public static readonly BindableProperty RowDefinitionsProperty

Field Value

BindableProperty

RowSpacingProperty

public static readonly BindableProperty RowSpacingProperty

Field Value

BindableProperty

SplitAlignProperty

public static readonly BindableProperty SplitAlignProperty

Field Value

BindableProperty

SplitProperty

public static readonly BindableProperty SplitProperty

Field Value

BindableProperty

SplitSpaceProperty

public static readonly BindableProperty SplitSpaceProperty

Field Value

BindableProperty

TemplatedFooterProperty

public static readonly BindableProperty TemplatedFooterProperty

Field Value

BindableProperty

TemplatedHeaderProperty

public static readonly BindableProperty TemplatedHeaderProperty

Field Value

BindableProperty

TypeProperty

public static readonly BindableProperty TypeProperty

Field Value

BindableProperty

WillDrawFromFreshItemssSource

protected long WillDrawFromFreshItemssSource

Field Value

long

WillMeasureFromFreshItemssSource

protected bool WillMeasureFromFreshItemssSource

Field Value

bool

_emptyView

protected SkiaControl _emptyView

Field Value

SkiaControl

_lockTemplates

protected readonly object _lockTemplates

Field Value

object

lockMeasureLayout

protected object lockMeasureLayout

Field Value

object

templatesInvalidated

protected bool templatesInvalidated

Field Value

bool

Properties

ApplyNewItemsSource

public bool ApplyNewItemsSource { get; set; }

Property Value

bool

BackgroundMeasurementProgress

public int BackgroundMeasurementProgress { get; }

Property Value

int

ChildrenFactory

public ViewsAdapter ChildrenFactory { get; protected set; }

Property Value

ViewsAdapter

ChildrenGrid

protected List<ISkiaControl> ChildrenGrid { get; set; }

Property Value

List<ISkiaControl>

ColumnDefinitions

[TypeConverter(typeof(ColumnDefinitionCollectionTypeConverter))]
public ColumnDefinitionCollection ColumnDefinitions { get; set; }

Property Value

ColumnDefinitionCollection

ColumnSpacing

Gets the amount of space left between columns in the GridLayout.

public double ColumnSpacing { get; set; }

Property Value

double

DebugString

public override string DebugString { get; }

Property Value

string

DefaultColumnDefinition

Will use this to create a missing but required ColumnDefinition

[TypeConverter(typeof(ColumnDefinitionTypeConverter))]
public ColumnDefinition DefaultColumnDefinition { get; set; }

Property Value

ColumnDefinition

DefaultRowDefinition

Will use this to create a missing but required RowDefinition

[TypeConverter(typeof(RowDefinitionTypeConverter))]
public RowDefinition DefaultRowDefinition { get; set; }

Property Value

RowDefinition

DynamicColumns

If true, will not create additional columns to match SplitMax if there are less real columns, and take additional space for drawing

public bool DynamicColumns { get; set; }

Property Value

bool

EmptyView

public SkiaControl EmptyView { get; set; }

Property Value

SkiaControl

EstimatedTotalItems

public int EstimatedTotalItems { get; }

Property Value

int

FirstMeasuredIndex

public int FirstMeasuredIndex { get; protected set; }

Property Value

int

FirstVisibleIndex

public int FirstVisibleIndex { get; protected set; }

Property Value

int

InvalidatedChildren

Will be modified by InvalidateByChild

protected HashSet<SkiaControl> InvalidatedChildren { get; set; }

Property Value

HashSet<SkiaControl>

InvalidatedChildrenInternal

Will use this when drawing

protected HashSet<SkiaControl> InvalidatedChildrenInternal { get; set; }

Property Value

HashSet<SkiaControl>

Invert

Layouts can use this property for custom logic appropriate to layout type.

public bool Invert { get; set; }

Property Value

bool

IsBackgroundMeasuring

public bool IsBackgroundMeasuring { get; }

Property Value

bool

IsEmpty

public bool IsEmpty { get; set; }

Property Value

bool

IsStack

Column/Row/Stack

public bool IsStack { get; }

Property Value

bool

IsTemplated

public override bool IsTemplated { get; }

Property Value

bool

ItemTemplatePoolSize

Default is -1, the number od template instances will not be less than data collection count. You can manually set to ta specific number to fill your viewport etc. Beware that if you set this to a number that will not be enough to fill the viewport binding contexts will contasntly be changing triggering screen update.

public int ItemTemplatePoolSize { get; set; }

Property Value

int

ItemsSource

public IList ItemsSource { get; set; }

Property Value

IList

LastMeasuredIndex

public int LastMeasuredIndex { get; protected set; }

Property Value

int

LastVisibleIndex

public int LastVisibleIndex { get; protected set; }

Property Value

int

LatestMeasuredStackStructure

public LayoutStructure LatestMeasuredStackStructure { get; }

Property Value

LayoutStructure

LatestStackStructure

public LayoutStructure LatestStackStructure { get; }

Property Value

LayoutStructure

MeasureItemsStrategy

public MeasuringStrategy MeasureItemsStrategy { get; set; }

Property Value

MeasuringStrategy

MeasuredItemsPercentage

Percentage of items that have been measured (0.0 to 1.0)

protected float MeasuredItemsPercentage { get; }

Property Value

float

NeedMeasure

public override bool NeedMeasure { get; set; }

Property Value

bool

RecyclingBuffer

Extra buffer zone for avoiding recycling
Default is 500pts - increase for less jaggy scroll, decrease for more memory efficiency

public double RecyclingBuffer { get; set; }

Property Value

double

RecyclingTemplate

In case of ItemsSource+ItemTemplate set will define should we reuse already created views: hidden items views will be reused for currently visible items on screen. If set to true inside a SkiaScrollLooped will cause it to redraw constantly even when idle because of the looped scroll mechanics.

public RecyclingTemplate RecyclingTemplate { get; set; }

Property Value

RecyclingTemplate

ReserveTemplates

For recycled cells: Default is 2, how many item templates above visible in viewport we must reserve in pool.

public int ReserveTemplates { get; set; }

Property Value

int

RowDefinitions

[TypeConverter(typeof(RowDefinitionCollectionTypeConverter))]
public RowDefinitionCollection RowDefinitions { get; set; }

Property Value

RowDefinitionCollection

RowSpacing

Gets the amount of space left between rows in the GridLayout.

public double RowSpacing { get; set; }

Property Value

double

ShouldInvalidateByChildren

public override bool ShouldInvalidateByChildren { get; }

Property Value

bool

Split

For Wrap number of columns/rows to split into, If 0 will use auto, if 1+ will have 1+ columns.

public int Split { get; set; }

Property Value

int

SplitAlign

Whether should keep same column width among rows

public bool SplitAlign { get; set; }

Property Value

bool

SplitSpace

How to distribute free space between children TODO

public SpaceDistribution SplitSpace { get; set; }

Property Value

SpaceDistribution

StackStructure

Used for StackLayout (Stack, Row) kind of layout

public LayoutStructure StackStructure { get; set; }

Property Value

LayoutStructure

StackStructureMeasured

When measuring we set this, and it will be swapped with StackStructure upon drawing so we don't affect the drawing if measuring in background.

public LayoutStructure StackStructureMeasured { get; set; }

Property Value

LayoutStructure

TemplatedFooter

Kind of BindableLayout.DrawnTemplate

public SkiaControl TemplatedFooter { get; set; }

Property Value

SkiaControl

TemplatedHeader

Kind of BindableLayout.DrawnTemplate

public SkiaControl TemplatedHeader { get; set; }

Property Value

SkiaControl

TotalMeasuredItems

public int TotalMeasuredItems { get; }

Property Value

int

Type

public LayoutType Type { get; set; }

Property Value

LayoutType

ViewportWasChanged

protected bool ViewportWasChanged { get; set; }

Property Value

bool

Methods

ActualizeSubviews()

public virtual void ActualizeSubviews()

ApplyBindingContext()

public override void ApplyBindingContext()

ApplyIsEmpty(bool)

protected virtual void ApplyIsEmpty(bool value)

Parameters

value bool

ApplyItemsSource()

Invalidate and re-apply ItemsSource

public virtual void ApplyItemsSource()

ApplyMeasureResult()

Normally get a a Measure by parent then parent calls Draw and we can apply the measure result. But in a case we have measured us ourselves inside PreArrange etc we must call ApplyMeasureResult because this would happen after the Draw and not before.

public override void ApplyMeasureResult()

ApplyResetChange()

Applies Reset changes to StackStructure

protected void ApplyResetChange()

ApplyStructureChanges()

Applies all pending structure changes to StackStructure - called from rendering pipeline

public void ApplyStructureChanges()

BreakLine()

public void BreakLine()

BuildGridLayout(SKSize)

protected void BuildGridLayout(SKSize constraints)

Parameters

constraints SKSize

CancelBackgroundMeasurement()

Cancels any ongoing background measurement

public void CancelBackgroundMeasurement()

CheckAndSetupIfEmpty()

protected virtual bool CheckAndSetupIfEmpty()

Returns

bool

Clear()

public void Clear()

CreateTemplatesInBackground()

protected Task CreateTemplatesInBackground()

Returns

Task

Draw(DrawingContext)

protected override void Draw(DrawingContext context)

Parameters

context DrawingContext

DrawChild(DrawingContext, ISkiaControl)

protected virtual bool DrawChild(DrawingContext ctx, ISkiaControl child)

Parameters

ctx DrawingContext
child ISkiaControl

Returns

bool

DrawChildrenGrid(DrawingContext)

Returns number of drawn children

protected virtual int DrawChildrenGrid(DrawingContext context)

Parameters

context DrawingContext

Returns

int

DrawList(DrawingContext, LayoutStructure)

Renders Templated Column/Row todo in some cases..

protected virtual int DrawList(DrawingContext ctx, LayoutStructure structure)

Parameters

ctx DrawingContext
structure LayoutStructure

Returns

int

DrawRenderObject(DrawingContext, CachedObject)

Todo where is this used i forgot completely

public override void DrawRenderObject(DrawingContext context, CachedObject cache)

Parameters

context DrawingContext
cache CachedObject

DrawStack(DrawingContext, LayoutStructure)

Renders stack/wrap layout. Returns number of drawn children.

protected virtual int DrawStack(DrawingContext ctx, LayoutStructure structure)

Parameters

ctx DrawingContext
structure LayoutStructure

Returns

int

DrawViews(DrawingContext)

Base method will call RenderViewsList. Return number of drawn views.

protected override int DrawViews(DrawingContext context)

Parameters

context DrawingContext

Returns

int

GetCacheDebugInfo()

Get debug information about cached views

public string GetCacheDebugInfo()

Returns

string

GetChildAt(float, float)

public SkiaControl GetChildAt(float x, float y)

Parameters

x float
y float

Returns

SkiaControl

GetChildIndexAt(SKPoint)

The point here is the position inside parent, can be offscreen

public ContainsPointResult GetChildIndexAt(SKPoint point)

Parameters

point SKPoint

Returns

ContainsPointResult

GetChildRect(ISkiaControl)

public SKRect GetChildRect(ISkiaControl child)

Parameters

child ISkiaControl

Returns

SKRect

GetChildRect(int)

public SKRect GetChildRect(int index)

Parameters

index int

Returns

SKRect

GetColumn(BindableObject)

Gets the column of the child element.

public int GetColumn(BindableObject bindable)

Parameters

bindable BindableObject

Returns

int

The column that the child element is in.

GetColumnSpan(BindableObject)

Gets the row span of the child element.

public int GetColumnSpan(BindableObject bindable)

Parameters

bindable BindableObject

Returns

int

The row that the child element is in.

GetEstimatedContentSize(float)

Gets estimated total content size for virtualized lists with unmeasured items

public ScaledSize GetEstimatedContentSize(float scale)

Parameters

scale float

Returns

ScaledSize

GetMeasuredContentEnd()

public double GetMeasuredContentEnd()

Returns

double

GetOnScreenVisibleArea(DrawingContext, Vector2)

For virtualization. For this method to be conditional we introduced the pixelsDestination parameter so that the Parent could return different visible areas upon context. Normally pass your current destination you are drawing into as this parameter.

public override ScaledRect GetOnScreenVisibleArea(DrawingContext context, Vector2 inflateByPixels = default)

Parameters

context DrawingContext
inflateByPixels Vector2

Returns

ScaledRect

GetOrderedSubviews(bool)

public override List<SkiaControl> GetOrderedSubviews(bool recalculate = false)

Parameters

recalculate bool

Returns

List<SkiaControl>

GetRow(BindableObject)

Gets the row of the child element.

public int GetRow(BindableObject bindable)

Parameters

bindable BindableObject

Returns

int

An integer that represents the row in which the item will appear.

GetRowSpan(BindableObject)

Gets the row span of the child element.

public int GetRowSpan(BindableObject bindable)

Parameters

bindable BindableObject

Returns

int

The row that the child element is in.

GetSizeKey(SKSize)

public int GetSizeKey(SKSize size)

Parameters

size SKSize

Returns

int

GetSpacingForIndex(int, float)

protected float GetSpacingForIndex(int forIndex, float scale)

Parameters

forIndex int
scale float

Returns

float

GetStackChildDrawRect(int, float, float, ControlInStack)

protected virtual SKRect GetStackChildDrawRect(int index, float x, float y, ControlInStack cell)

Parameters

index int
x float
y float
cell ControlInStack

Returns

SKRect

GetTemplatesPoolLimit()

protected virtual int GetTemplatesPoolLimit()

Returns

int

GetTemplatesPoolPrefill()

protected virtual int GetTemplatesPoolPrefill()

Returns

int

GetVisibleChildIndexAt(SKPoint)

The point here is the rendering location, always on screen

public virtual ContainsPointResult GetVisibleChildIndexAt(SKPoint point)

Parameters

point SKPoint

Returns

ContainsPointResult

GetVisualChildren()

For Xaml HotReload. This is semetimes not called when we add and remove views.

public override IReadOnlyList<IVisualTreeElement> GetVisualChildren()

Returns

IReadOnlyList<IVisualTreeElement>

HandleCollectionChangeWithStructurePreservation(NotifyCollectionChangedEventArgs)

Handles collection changes while preserving existing measurement structure

protected virtual void HandleCollectionChangeWithStructurePreservation(NotifyCollectionChangedEventArgs args)

Parameters

args NotifyCollectionChangedEventArgs

HandleStructurePreservingAdd(NotifyCollectionChangedEventArgs)

Handles Add collection changes while preserving existing structure

protected virtual void HandleStructurePreservingAdd(NotifyCollectionChangedEventArgs args)

Parameters

args NotifyCollectionChangedEventArgs

HandleStructurePreservingMove(NotifyCollectionChangedEventArgs)

Handles Move collection changes while preserving existing structure

protected virtual void HandleStructurePreservingMove(NotifyCollectionChangedEventArgs args)

Parameters

args NotifyCollectionChangedEventArgs

HandleStructurePreservingRemove(NotifyCollectionChangedEventArgs)

Handles Remove collection changes while preserving existing structure

protected virtual void HandleStructurePreservingRemove(NotifyCollectionChangedEventArgs args)

Parameters

args NotifyCollectionChangedEventArgs

HandleStructurePreservingReplace(NotifyCollectionChangedEventArgs)

Handles Replace collection changes while preserving existing structure

protected virtual void HandleStructurePreservingReplace(NotifyCollectionChangedEventArgs args)

Parameters

args NotifyCollectionChangedEventArgs

HandleStructurePreservingReset(NotifyCollectionChangedEventArgs)

Handles Reset collection changes while preserving existing structure

protected virtual void HandleStructurePreservingReset(NotifyCollectionChangedEventArgs args)

Parameters

args NotifyCollectionChangedEventArgs

Invalidate()

Base calls InvalidateInternal and InvalidateParent

public override void Invalidate()

Invalidate(BindableObject, object, object)

protected static void Invalidate(BindableObject bindable, object oldValue, object newValue)

Parameters

bindable BindableObject
oldValue object
newValue object

InvalidateByChild(SkiaControl)

To be able to fast track dirty children

public override void InvalidateByChild(SkiaControl child)

Parameters

child SkiaControl

InvalidateInternal()

Soft invalidation, without requiring update. So next time we try to draw this one it will recalc everything.

public override void InvalidateInternal()

InvalidateViewsList()

public override void InvalidateViewsList()

IsGestureForChild(SkiaControlWithRect, SKPoint)

public override bool IsGestureForChild(SkiaControlWithRect child, SKPoint point)

Parameters

child SkiaControlWithRect
point SKPoint

Returns

bool

IsViewportAtEndOfMeasuredContent(ScaledRect)

Checks if we allow scroll to load more

protected virtual bool IsViewportAtEndOfMeasuredContent(ScaledRect viewport)

Parameters

viewport ScaledRect

Returns

bool

LayoutCell(ScaledSize, ControlInStack, SkiaControl, SKRect, float)

public virtual void LayoutCell(ScaledSize measured, ControlInStack cell, SkiaControl child, SKRect rectForChildrenPixels, float scale)

Parameters

measured ScaledSize
cell ControlInStack
child SkiaControl
rectForChildrenPixels SKRect
scale float

MeasureAbsolute(SKRect, float)

Measure children inside absolute layout

public override ScaledSize MeasureAbsolute(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

MeasureAdditionalItems(int, int, float)

public int MeasureAdditionalItems(int batchSize, int aheadCount, float scale)

Parameters

batchSize int
aheadCount int
scale float

Returns

int

MeasureAndArrangeCell(SKRect, ControlInStack, SkiaControl, SKRect, float)

protected virtual ScaledSize MeasureAndArrangeCell(SKRect destination, ControlInStack cell, SkiaControl child, SKRect rectForChildrenPixels, float scale)

Parameters

destination SKRect
cell ControlInStack
child SkiaControl
rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

MeasureGrid(SKRect, float)

Measures the grid layout and ensures columns fill available width when NeedAutoWidth is false

public virtual ScaledSize MeasureGrid(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect

Available rectangle in pixels

scale float

Rendering scale

Returns

ScaledSize

Measured size of the grid

MeasureLayout(MeasureRequest, bool)

public virtual ScaledSize MeasureLayout(MeasureRequest request, bool force)

Parameters

request MeasureRequest
force bool

Returns

ScaledSize

MeasureList(SKRect, float)

Enhanced MeasureList with background measurement support

public virtual ScaledSize MeasureList(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

MeasureSingleItem(int, SKRect, float, CancellationToken, bool)

Measures a single item in the background and stages it for structure update. For MeasureVisible Only.

public void MeasureSingleItem(int itemIndex, SKRect constraints, float scale, CancellationToken cancellationToken, bool inBackground)

Parameters

itemIndex int
constraints SKRect
scale float
cancellationToken CancellationToken
inBackground bool

MeasureStack(SKRect, float, LayoutStructure, bool, SkiaControl, SkiaControl[])

Core measurement logic shared between templated and non-templated scenarios

protected virtual ScaledSize MeasureStack(SKRect rectForChildrenPixels, float scale, LayoutStructure layoutStructure, bool isTemplated, SkiaControl template, SkiaControl[] nonTemplated)

Parameters

rectForChildrenPixels SKRect
scale float
layoutStructure LayoutStructure
isTemplated bool
template SkiaControl
nonTemplated SkiaControl[]

Returns

ScaledSize

MeasureStackLegacy(SKRect, float)

Measuring column/row

public virtual ScaledSize MeasureStackLegacy(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

MeasureStackNonTemplated(SKRect, float)

Measuring column/row with 3-pass approach to handle Fill options correctly

public virtual ScaledSize MeasureStackNonTemplated(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

MeasureStackTemplated(SKRect, float)

Measuring column/row for templated for fastest way possible

public virtual ScaledSize MeasureStackTemplated(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

MeasureWrap(SKRect, float)

TODO for templated measure only visible?! and just reserve predicted scroll amount for scrolling

public virtual ScaledSize MeasureWrap(SKRect rectForChildrenPixels, float scale)

Parameters

rectForChildrenPixels SKRect
scale float

Returns

ScaledSize

OnAfterDrawingVisibleChildren(DrawingContext, LayoutStructure, List<ControlInStack>)

Can be called by some layouts after they draw visible children

protected virtual void OnAfterDrawingVisibleChildren(DrawingContext ctx, LayoutStructure structure, List<ControlInStack> visibleElements)

Parameters

ctx DrawingContext
structure LayoutStructure
visibleElements List<ControlInStack>

OnAppeared()

This event can sometimes be called without prior OnAppearing

public virtual void OnAppeared()

OnAppearing()

This can sometimes be omitted,

public virtual void OnAppearing()

OnBeforeDrawingVisibleChildren(DrawingContext, LayoutStructure, List<ControlInStack>)

Can be called by some layouts after they calculated the list of visible children to be drawn, but have not drawn them yet

protected virtual void OnBeforeDrawingVisibleChildren(DrawingContext ctx, LayoutStructure structure, List<ControlInStack> visibleElements)

Parameters

ctx DrawingContext
structure LayoutStructure
visibleElements List<ControlInStack>

OnChildrenChanged()

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

public override void OnChildrenChanged()

OnDisappeared()

public virtual void OnDisappeared()

OnDisappearing()

public virtual void OnDisappearing()

OnDisposing()

Base performs some cleanup actions with Superview

public override void OnDisposing()

OnItemSourceChanged()

public virtual void OnItemSourceChanged()

OnItemTemplateChanged()

public override void OnItemTemplateChanged()

OnItemsSourceChangesApplied()

Triggers after a new ItemsSource was set or an observable collection of an existing one was changed

protected virtual void OnItemsSourceChangesApplied()

OnItemsSourceCollectionChanged(object, NotifyCollectionChangedEventArgs)

Enhanced collection change handler with smart handling and fallback

protected virtual void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)

Parameters

sender object
args NotifyCollectionChangedEventArgs

OnLayoutChanged()

DrawingRect size changed

protected override void OnLayoutChanged()

OnLayoutReady()

Layout was changed with dimensions above zero. Rather a helper method, can you more generic OnLayoutChanged().

protected override void OnLayoutReady()

OnLoaded()

IInsideViewport interface: loaded is called when the view is created, but not yet visible

public virtual void OnLoaded()

OnMeasured()

protected override void OnMeasured()

OnMeasuring(float, float, float)

If you call this while measurement is in process (IsMeasuring==True) will return last measured value.

public override ScaledSize OnMeasuring(float widthConstraint, float heightConstraint, float scale)

Parameters

widthConstraint float
heightConstraint float
scale float

Returns

ScaledSize

OnPrintDebug()

Enhanced debug printing

public override void OnPrintDebug()

OnTemplatesAvailable()

public virtual void OnTemplatesAvailable()

OnViewportWasChanged(ScaledRect)

Will be called when viewport containing this view has changed

public virtual void OnViewportWasChanged(ScaledRect viewport)

Parameters

viewport ScaledRect

Paint(DrawingContext)

This is the main drawing routine you should override to draw something. Base one paints background color inside DrawingRect that was defined by Arrange inside base.Draw. Pass arguments if you want to use some time-frozen data for painting at any time from any thread..

protected override void Paint(DrawingContext ctx)

Parameters

ctx DrawingContext

PreArrange(SKRect, float, float, float)

Returns false if should not render

public override bool PreArrange(SKRect destination, float widthRequest, float heightRequest, float scale)

Parameters

destination SKRect
widthRequest float
heightRequest float
scale float

Returns

bool

PropagateVisibilityChanged(bool)

protected override void PropagateVisibilityChanged(bool newvalue)

Parameters

newvalue bool

RefreshAllViews()

Force a full refresh of all cached views (useful for debugging)

public void RefreshAllViews()

RemeasureSingleItemInBackground(int)

Remeasures a single item in the background and updates it in the existing structure

public void RemeasureSingleItemInBackground(int itemIndex)

Parameters

itemIndex int

ReportChildVisibilityChanged(int, bool)

Called by templated cells to report visibility changes. This stages the visibility change to be applied during the next rendering cycle.

public virtual void ReportChildVisibilityChanged(int cellIndex, bool isVisible)

Parameters

cellIndex int

The index of the cell in the ItemsSource

isVisible bool

The new visibility state

ReportChildVisibilityChanged(int, int, bool)

Called by templated cells to report visibility changes for multiple cells. This stages the visibility change to be applied during the next rendering cycle.

public virtual void ReportChildVisibilityChanged(int startIndex, int count, bool isVisible)

Parameters

startIndex int

The starting index of cells in the ItemsSource

count int

The number of cells to change

isVisible bool

The new visibility state

ReportHotreloadChildAdded(SkiaControl)

public override void ReportHotreloadChildAdded(SkiaControl child)

Parameters

child SkiaControl

ReportHotreloadChildRemoved(SkiaControl)

public override void ReportHotreloadChildRemoved(SkiaControl control)

Parameters

control SkiaControl

ResetScroll()

public virtual void ResetScroll()

SetChildren(IEnumerable<SkiaControl>)

public override void SetChildren(IEnumerable<SkiaControl> views)

Parameters

views IEnumerable<SkiaControl>

SetColumn(BindableObject, int)

public void SetColumn(BindableObject bindable, int value)

Parameters

bindable BindableObject
value int

SetColumnSpan(BindableObject, int)

public void SetColumnSpan(BindableObject bindable, int value)

Parameters

bindable BindableObject
value int

SetMeasured(float, float, bool, bool, float)

Parameters in PIXELS. sets IsLayoutDirty = true;

protected override ScaledSize SetMeasured(float width, float height, bool widthCut, bool heightCut, float scale)

Parameters

width float
height float
widthCut bool
heightCut bool
scale float

Returns

ScaledSize

SetRow(BindableObject, int)

public void SetRow(BindableObject bindable, int value)

Parameters

bindable BindableObject
value int

SetRowSpan(BindableObject, int)

public void SetRowSpan(BindableObject bindable, int value)

Parameters

bindable BindableObject
value int

SetupViews()

protected virtual void SetupViews()

ShouldPreserveStructureOnCollectionChange(NotifyCollectionChangedEventArgs)

Determines if collection changes should preserve existing measurement structure

protected virtual bool ShouldPreserveStructureOnCollectionChange(NotifyCollectionChangedEventArgs args)

Parameters

args NotifyCollectionChangedEventArgs

Returns

bool

ShouldTriggerLoadMore(ScaledRect)

Determines whether LoadMore should be triggered based on viewport position and measurement state. This prevents race conditions by considering background measurement progress.

public virtual bool ShouldTriggerLoadMore(ScaledRect viewport)

Parameters

viewport ScaledRect

Returns

bool

StageStructureChange(StructureChange)

Stages a structure change for processing during rendering pipeline

protected virtual void StageStructureChange(SkiaLayout.StructureChange change)

Parameters

change SkiaLayout.StructureChange

UpdateRowColumnBindingContexts()

protected void UpdateRowColumnBindingContexts()

UpdateSizeChangedHandlers(BindableObject, object, object)

protected static void UpdateSizeChangedHandlers(BindableObject bindable, object oldValue, object newValue)

Parameters

bindable BindableObject
oldValue object
newValue object

Events

IsEmptyChanged

public event EventHandler<bool> IsEmptyChanged

Event Type

EventHandler<bool>

ItemsSourceChangesApplied

public event EventHandler ItemsSourceChangesApplied

Event Type

EventHandler