Class LayoutHelper
Provides helper methods needed for layout.
public static class LayoutHelper
- Inheritance
-
LayoutHelper
- Inherited Members
Properties
LayoutEpsilon
Epsilon value used for certain layout calculations. Based on the value in WPF LayoutDoubleUtil.
public static double LayoutEpsilon { get; }
Property Value
Methods
ApplyLayoutConstraints(Layoutable, Size)
Calculates a control's size based on its Width, Height, MinWidth, MaxWidth, MinHeight and MaxHeight.
public static Size ApplyLayoutConstraints(Layoutable control, Size constraints)
Parameters
control
LayoutableThe control.
constraints
SizeThe space available for the control.
Returns
- Size
The control's size.
ArrangeChild(Layoutable?, Size, Thickness)
public static Size ArrangeChild(Layoutable? child, Size availableSize, Thickness padding)
Parameters
child
LayoutableavailableSize
Sizepadding
Thickness
Returns
ArrangeChild(Layoutable?, Size, Thickness, Thickness)
public static Size ArrangeChild(Layoutable? child, Size availableSize, Thickness padding, Thickness borderThickness)
Parameters
child
LayoutableavailableSize
Sizepadding
ThicknessborderThickness
Thickness
Returns
GetLayoutScale(Layoutable)
Obtains layout scale of the given control.
public static double GetLayoutScale(Layoutable control)
Parameters
control
LayoutableThe control.
Returns
Exceptions
- Exception
Thrown when control has no root or returned layout scaling is invalid.
InvalidateSelfAndChildrenMeasure(Layoutable)
Invalidates measure for given control and all visual children recursively.
public static void InvalidateSelfAndChildrenMeasure(Layoutable control)
Parameters
control
Layoutable
MeasureChild(Layoutable?, Size, Thickness)
public static Size MeasureChild(Layoutable? control, Size availableSize, Thickness padding)
Parameters
control
LayoutableavailableSize
Sizepadding
Thickness
Returns
MeasureChild(Layoutable?, Size, Thickness, Thickness)
public static Size MeasureChild(Layoutable? control, Size availableSize, Thickness padding, Thickness borderThickness)
Parameters
control
LayoutableavailableSize
Sizepadding
ThicknessborderThickness
Thickness
Returns
RoundLayoutSizeUp(Size, double, double)
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 static Size RoundLayoutSizeUp(Size size, double dpiScaleX, double dpiScaleY)
Parameters
size
SizeInput size.
dpiScaleX
doubleDPI along x-dimension.
dpiScaleY
doubleDPI along y-dimension.
Returns
- Size
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(Thickness, double, double)
Rounds a thickness to integer values for layout purposes, compensating for high DPI screen coordinates.
public static Thickness RoundLayoutThickness(Thickness thickness, double dpiScaleX, double dpiScaleY)
Parameters
thickness
ThicknessInput thickness.
dpiScaleX
doubleDPI along x-dimension.
dpiScaleY
doubleDPI along y-dimension.
Returns
- Thickness
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(double, double)
Calculates the value to be used for layout rounding at high DPI by rounding the value up or down to the nearest pixel.
public static double RoundLayoutValue(double value, double dpiScale)
Parameters
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(double, double)
Calculates the value to be used for layout rounding at high DPI by rounding the value up to the nearest pixel.
public static double RoundLayoutValueUp(double value, double dpiScale)
Parameters
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.