Skip to content

Class GridItemLayout.Length

Definition

Namespace: StardewUI.Widgets
Assembly: StardewUI.dll

A GridItemLayout specifying that each item is to have the same fixed length (width or height, depending on the grid's Orientation) and to wrap to the next row/column afterward.

public record GridItemLayout.Length : StardewUI.Widgets.GridItemLayout, 
    IEquatable<StardewUI.Widgets.GridItemLayout.Length>

Inheritance
ObjectGridItemLayout ⇦ Length

Implements
IEquatable<Length>

Members

Constructors

Name Description
Length(Single, Boolean) A GridItemLayout specifying that each item is to have the same fixed length (width or height, depending on the grid's Orientation) and to wrap to the next row/column afterward.

Properties

Name Description
EqualityContract (Overrides GridItemLayout.get_EqualityContract())
Expandable Whether the length of cells should expand (uniformly) to fill the grid's primary layout size, i.e. when that size is not an exact multiple of the total size of all cells that can fit.
Px The length, in pixels, of each item along the grid's orientation axis.

Methods

Name Description
GetItemCountAndLength(Single, Single) Computes the length (along the grid's PrimaryOrientation axis) of a single item, and the number of items that can fit before wrapping.
(Overrides GridItemLayout.GetItemCountAndLength(Single, Single))

Details

Constructors

Length(float, bool)

A GridItemLayout specifying that each item is to have the same fixed length (width or height, depending on the grid's Orientation) and to wrap to the next row/column afterward.

public Length(float Px, bool Expandable);
Parameters

Px   Single
The length, in pixels, of each item along the grid's orientation axis.

Expandable   Boolean
Whether the length of cells should expand (uniformly) to fill the grid's primary layout size, i.e. when that size is not an exact multiple of the total size of all cells that can fit.


Properties

EqualityContract

protected System.Type EqualityContract { get; }
Property Value

Type


Expandable

Whether the length of cells should expand (uniformly) to fill the grid's primary layout size, i.e. when that size is not an exact multiple of the total size of all cells that can fit.

public bool Expandable { get; set; }
Property Value

Boolean


Px

The length, in pixels, of each item along the grid's orientation axis.

public float Px { get; set; }
Property Value

Single


Methods

GetItemCountAndLength(float, float)

Computes the length (along the grid's PrimaryOrientation axis) of a single item, and the number of items that can fit before wrapping.

public override ValueTuple<System.Single, System.Int32> GetItemCountAndLength(float available, float spacing);
Parameters

available   Single
The length available along the same axis.

spacing   Single
Spacing between items, to adjust count-based layouts.

Returns

ValueTuple<Single, Int32>

The length to apply to each item.