GetInitialConstraint(Control, Int32, Size) Method

Definition

Assembly Avalonia.Controls.TreeDataGrid.dll

Gets the initial constraint for the first pass of the two-pass measure.

protected virtual Size GetInitialConstraint(Control element, int index, Size availableSize)

Parameters

element
Avalonia.Controls.Control

The element being measured.

index
Int32

The index of the element.

availableSize
Avalonia.Size

The available size.

Returns

Avalonia.Size
The measure constraint for the element.

Remarks

The measure pass is split into two parts:

  • The initial pass is used to determine the "natural" size of the elements. In this pass, infinity can be used as the measure constraint if the element has no other constraints on its size.
  • The final pass is made once the "natural" sizes of the elements are known and any layout logic has been run. This pass is needed because controls should not be arranged with a size less than that passed as the constraint during the measure pass. This pass is only run if NeedsFinalMeasurePass(Int32, IReadOnlyList<Control?>) returns true.