s&box docs
API ReferenceSandbox.UI

public sealed struct Sandbox.UI.Length

A variable unit based length. ie, could be a percentage or a pixel length. This is commonly used to express the size of things in UI space, usually coming from style sheets.

Broader workflow and conceptual references connected to this API.

Methods

Showing 13 methods

public static System.Nullable`1<Sandbox.UI.Length> Calc(string expression)

Create a length based on a css calc expression

public static Sandbox.UI.Length Em(float value)

Create a length based on the font size of the current element.

Parameters

  • value: Value in em

Returns

A new length

public static System.Nullable`1<Sandbox.UI.Length> Fraction(float fraction)

Create a length in percents

Parameters

  • fraction: The fraction of a percent (0 = 0%, 1 = 100%)

Returns

A new length

public static System.Nullable`1<Sandbox.UI.Length> Parse(string value)

Parse a length. This is used by the stylesheet parsing system.

Parameters

  • value: A length represented by a string

Example

Built-in examples define the default contract and should be read first.

public static System.Nullable`1<Sandbox.UI.Length> Percent(float percent)

Create a length in percents

Parameters

  • percent: The amount of percent for this (0-100)

Returns

A new length

public static System.Nullable`1<Sandbox.UI.Length> Pixels(float pixels)

Create a length in pixels

Parameters

  • pixels: The amount of pixels for this length

Returns

A new length

public static Sandbox.UI.Length Rem(float value)

Create a length based on the font size of the root element.

Parameters

  • value: Value in rem

Returns

A new length

public static System.Nullable`1<Sandbox.UI.Length> ViewHeight(float percentage)

Create a length based on the view height

Parameters

  • percentage: The amount of percent for this (0-100)

Returns

A new length

public static System.Nullable`1<Sandbox.UI.Length> ViewMax(float percentage)

Create a length based on the longest edge of the screen size

Parameters

  • percentage: The amount of percent for this (0-100)

Returns

A new length

public static System.Nullable`1<Sandbox.UI.Length> ViewMin(float percentage)

Create a length based on the shortest edge of the screen size

Parameters

  • percentage: The amount of percent for this (0-100)

Returns

A new length

public static System.Nullable`1<Sandbox.UI.Length> ViewWidth(float percentage)

Create a length based on the view width

Parameters

  • percentage: The amount of percent for this (0-100)

Returns

A new length

Properties

Showing 4 properties

public static Sandbox.UI.Length Sandbox.UI.Length.Auto { get; set; }

Quickly create a Length with Unit set to LengthUnit.Auto

public static Sandbox.UI.Length Sandbox.UI.Length.Contain { get; set; }

Quickly create a Length with Unit set to LengthUnit.Contain

public static Sandbox.UI.Length Sandbox.UI.Length.Cover { get; set; }

Quickly create a Length with Unit set to LengthUnit.Cover

Metadata

FieldValue
NamespaceSandbox.UI
Typeclass
AssemblySandbox.System
Doc IDT:Sandbox.UI.Length

On this page