Size

A width and height pair used by the measure/arrange layout.
public readonly record struct Size(double Width, double Height)

Constructors

Initializes a new instance of the Size struct.

public Size(
  double Width,
  double Height)
ParameterSummary
double WidthThe horizontal extent.
double HeightThe vertical extent.

Properties

Height

The vertical extent.

Type: double

public double Height { get; init; }

IsFinite

True when both axes are finite (neither infinite nor NaN).

Type: bool

public bool IsFinite { get; }

Width

The horizontal extent.

Type: double

public double Width { get; init; }

Methods

Deflate

Returns this size shrunk by thickness on both axes, clamped at zero.

public Size Deflate(
  Thickness thickness)
ParameterSummary
Thickness thicknessThe margins or padding to subtract.

Returns

  • Size: The deflated size.

Inflate

Returns this size grown by thickness on both axes.

public Size Inflate(
  Thickness thickness)
ParameterSummary
Thickness thicknessThe margins or padding to add.

Returns

  • Size: The inflated size.

Fields

Infinity

A size unconstrained on both axes, used when measuring content that may grow without bound.

Type: Size

public static readonly Size Infinity

Zero

A size of zero width and height.

Type: Size

public static readonly Size Zero