Table of Contents

Interface IChildIndexProvider

Namespace
Avalonia.LogicalTree
Assembly
Avalonia.Base.dll

Child's index and total count information provider used by list-controls (ListBox, StackPanel, etc.)

public interface IChildIndexProvider

Remarks

Used by nth-child and nth-last-child selectors.

Methods

GetChildIndex(ILogical)

Gets child's actual index in order of the original source.

int GetChildIndex(ILogical child)

Parameters

child ILogical

Logical child.

Returns

int

Index or -1 if child was not found.

TryGetTotalCount(out int)

Total children count or null if source is infinite. Some Avalonia features might not work if TryGetTotalCount(out int) returns false, for instance: nth-last-child selector.

bool TryGetTotalCount(out int count)

Parameters

count int

Returns

bool

Events

ChildIndexChanged

Notifies subscriber when a child's index was changed.

event EventHandler<ChildIndexChangedEventArgs>? ChildIndexChanged

Event Type

EventHandler<ChildIndexChangedEventArgs>