Skip to main content

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.

Definition

Namespace: Avalonia.Layout
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static double RoundLayoutValue(
double value,
double dpiScale
)

Parameters

  Double
Input value to be rounded.
  Double
Ratio of screen's DPI to layout DPI

Return Value

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.

See Also

Reference

LayoutHelper Class
Avalonia.Layout Namespace