Lengthclass
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.
Methods13
Showing 13 methods
public static System.Nullable`1<Sandbox.UI.Length> Calc(string expression)
Create a length based on a css calc expression
| Parameter | Type | Description |
|---|---|---|
| expression | string | — |
public static Sandbox.UI.Length Em(float value)
Create a length based on the font size of the current element.
| Parameter | Type | Description |
|---|---|---|
| value | float | Value in em |
public static System.Nullable`1<Sandbox.UI.Length> Fraction(float fraction)
Create a length in percents
| Parameter | Type | Description |
|---|---|---|
| fraction | float | The fraction of a percent (0 = 0%, 1 = 100%) |
public static System.Nullable`1<Sandbox.UI.Length> Parse(string value)
Parse a length. This is used by the stylesheet parsing system.
| Parameter | Type | Description |
|---|---|---|
| value | string | 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
| Parameter | Type | Description |
|---|---|---|
| percent | float | The amount of percent for this (0-100) |
public static System.Nullable`1<Sandbox.UI.Length> Pixels(float pixels)
Create a length in pixels
| Parameter | Type | Description |
|---|---|---|
| pixels | float | The amount of pixels for this length |
public static Sandbox.UI.Length Rem(float value)
Create a length based on the font size of the root element.
| Parameter | Type | Description |
|---|---|---|
| value | float | Value in rem |
public static System.Nullable`1<Sandbox.UI.Length> ViewHeight(float percentage)
Create a length based on the view height
| Parameter | Type | Description |
|---|---|---|
| percentage | float | The amount of percent for this (0-100) |
public static System.Nullable`1<Sandbox.UI.Length> ViewMax(float percentage)
Create a length based on the longest edge of the screen size
| Parameter | Type | Description |
|---|---|---|
| percentage | float | The amount of percent for this (0-100) |
No results match this filter.
Properties4
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
No results match this filter.