LayoutHelper.

RoundLayoutSize(Size, double, double) Method

Summary

Rounds a size to integer values for layout purposes, compensating for high DPI screen coordinates.
Namespace
Avalonia.Layout
Containing Type
LayoutHelper

Syntax

public static Size RoundLayoutSize(Size size, double dpiScaleX, double dpiScaleY)

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.

Parameters

Name Type Description
size Size Input size.
dpiScaleX double DPI along x-dimension.
dpiScaleY double DPI along y-dimension.

Return Value

Type Description
Size Value of size that will be rounded under screen DPI.