LayoutHelper Class
Definition
Provides helper methods needed for layout.
public class LayoutHelper
Methods
| Name | Description |
|---|---|
| ApplyLayoutConstraints | Calculates a control's size based on its Avalonia.Layout.Layoutable.Width, Avalonia.Layout.Layoutable.Height, Avalonia.Layout.Layoutable.MinWidth, Avalonia.Layout.Layoutable.MaxWidth, Avalonia.Layout.Layoutable.MinHeight and Avalonia.Layout.Layoutable.MaxHeight. |
| ArrangeChild (2 overloads) | No summary available. |
| GetLayoutScale | Obtains layout scale of the given control. |
| InvalidateSelfAndChildrenMeasure | Invalidates measure for given control and all visual children recursively. |
| MeasureChild (2 overloads) | No summary available. |
| RoundLayoutPoint | No summary available. |
| RoundLayoutSizeUp | Rounds a size to integer values for layout purposes, compensating for high DPI screen coordinates by rounding the size up to the nearest pixel. |
| RoundLayoutThickness | Rounds a thickness to integer values for layout purposes, compensating for high DPI screen coordinates. |
| RoundLayoutValue | Calculates the value to be used for layout rounding at high DPI by rounding the value up or down to the nearest pixel. |
| RoundLayoutValueUp | Calculates the value to be used for layout rounding at high DPI by rounding the value up to the nearest pixel. |
ApplyLayoutConstraints Method
Calculates a control's size based on its Avalonia.Layout.Layoutable.Width, Avalonia.Layout.Layoutable.Height, Avalonia.Layout.Layoutable.MinWidth, Avalonia.Layout.Layoutable.MaxWidth, Avalonia.Layout.Layoutable.MinHeight and Avalonia.Layout.Layoutable.MaxHeight.
public Avalonia.Size ApplyLayoutConstraints(Avalonia.Layout.Layoutable control, Avalonia.Size constraints)
Parameters
control Avalonia.Layout.Layoutable
The control.
constraints Avalonia.Size
The space available for the control.
Returns
The control's size.
ArrangeChild overloads
ArrangeChild Method
public Avalonia.Size ArrangeChild(Avalonia.Layout.Layoutable child, Avalonia.Size availableSize, Avalonia.Thickness padding)
Parameters
child Avalonia.Layout.Layoutable
availableSize Avalonia.Size
padding Avalonia.Thickness
Returns
ArrangeChild Method
public Avalonia.Size ArrangeChild(Avalonia.Layout.Layoutable child, Avalonia.Size availableSize, Avalonia.Thickness padding, Avalonia.Thickness borderThickness)
Parameters
child Avalonia.Layout.Layoutable
availableSize Avalonia.Size
padding Avalonia.Thickness
borderThickness Avalonia.Thickness
Returns
GetLayoutScale Method
Obtains layout scale of the given control.
public double GetLayoutScale(Avalonia.Layout.Layoutable control)
Parameters
control Avalonia.Layout.Layoutable
The control.
Returns
double
Exceptions
InvalidateSelfAndChildrenMeasure Method
Invalidates measure for given control and all visual children recursively.
public void InvalidateSelfAndChildrenMeasure(Avalonia.Layout.Layoutable control)
Parameters
control Avalonia.Layout.Layoutable
MeasureChild overloads
MeasureChild Method
public Avalonia.Size MeasureChild(Avalonia.Layout.Layoutable control, Avalonia.Size availableSize, Avalonia.Thickness padding)
Parameters
control Avalonia.Layout.Layoutable
availableSize Avalonia.Size
padding Avalonia.Thickness
Returns
MeasureChild Method
public Avalonia.Size MeasureChild(Avalonia.Layout.Layoutable control, Avalonia.Size availableSize, Avalonia.Thickness padding, Avalonia.Thickness borderThickness)
Parameters
control Avalonia.Layout.Layoutable
availableSize Avalonia.Size
padding Avalonia.Thickness
borderThickness Avalonia.Thickness
Returns
RoundLayoutPoint Method
public Avalonia.Point RoundLayoutPoint(Avalonia.Point point, double dpiScale)
Parameters
point Avalonia.Point
dpiScale double
Returns
RoundLayoutSizeUp Method
Rounds a size to integer values for layout purposes, compensating for high DPI screen coordinates by rounding the size up to the nearest pixel.
public Avalonia.Size RoundLayoutSizeUp(Avalonia.Size size, double dpiScale)
Parameters
size Avalonia.Size
Input size.
dpiScale double
The DPI scale.
Returns
Value of size that will be rounded under screen DPI.
Remarks
This is a layout helper method. It takes DPI into account and also does not return the rounded value if it is unacceptable for layout, e.g. Infinity or NaN. It's a helper associated with the UseLayoutRounding property and should not be used as a general rounding utility.
RoundLayoutThickness Method
Rounds a thickness to integer values for layout purposes, compensating for high DPI screen coordinates.
public Avalonia.Thickness RoundLayoutThickness(Avalonia.Thickness thickness, double dpiScale)
Parameters
thickness Avalonia.Thickness
Input thickness.
dpiScale double
The DPI scale.
Returns
Value of thickness that will be rounded under screen DPI.
Remarks
This is a layout helper method. It takes DPI into account and also does not return the rounded value if it is unacceptable for layout, e.g. Infinity or NaN. It's a helper associated with the UseLayoutRounding property and should not be used as a general rounding utility.
RoundLayoutValue Method
Calculates the value to be used for layout rounding at high DPI by rounding the value up or down to the nearest pixel.
public double RoundLayoutValue(double value, double dpiScale)
Parameters
value double
Input value to be rounded.
dpiScale double
Ratio of screen's DPI to layout DPI
Returns
double
Adjusted value that will produce layout rounding on screen at high dpi.
Remarks
This is a layout helper method. It takes DPI into account and also does not return the rounded value if it is unacceptable for layout, e.g. Infinity or NaN. It's a helper associated with the UseLayoutRounding property and should not be used as a general rounding utility.
RoundLayoutValueUp Method
Calculates the value to be used for layout rounding at high DPI by rounding the value up to the nearest pixel.
public double RoundLayoutValueUp(double value, double dpiScale)
Parameters
value double
Input value to be rounded.
dpiScale double
Ratio of screen's DPI to layout DPI
Returns
double
Adjusted value that will produce layout rounding on screen at high dpi.
Remarks
This is a layout helper method. It takes DPI into account and also does not return the rounded value if it is unacceptable for layout, e.g. Infinity or NaN. It's a helper associated with the UseLayoutRounding property and should not be used as a general rounding utility.
Properties
| Name | Description |
|---|---|
| LayoutEpsilon | Epsilon value used for certain layout calculations. Based on the value in WPF LayoutDoubleUtil. |
LayoutEpsilon Property
Epsilon value used for certain layout calculations. Based on the value in WPF LayoutDoubleUtil.
public double LayoutEpsilon { get; set; }