struct Length

in global :: Sandbox . UI

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.


public float Value

The meaning of the value is dependent on .

public LengthUnit Unit

How to determine the final length. Commonly used with Pixel or Percentage.

public float GetPixels( float dimension )

Convert to a pixel value. Use the dimension to work out percentage values.

public float GetPixels( float dimension, float contentSize )

Get the pixel size but also evaluate content size to support use Start, End, Center

public static Nullable<Length> Pixels( float pixels )

Create a length in pixels

  • pixels The amount of pixels for this length
  • Returns A new length

public static Nullable<Length> Percent( float percent )

Create a length in percents

  • percent The amount of percent for this (0-100)
  • Returns A new length

public static Nullable<Length> ViewHeight( float percentage )

Create a length based on the view height

  • percentage The amount of percent for this (0-100)
  • Returns A new length

public static Nullable<Length> ViewWidth( float percentage )

Create a length based on the view width

  • percentage The amount of percent for this (0-100)
  • Returns A new length

public static Nullable<Length> ViewMax( float percentage )

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

  • percentage The amount of percent for this (0-100)
  • Returns A new length

public static Nullable<Length> ViewMin( float percentage )

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

  • percentage The amount of percent for this (0-100)
  • Returns A new length

public static Nullable<Length> Fraction( float fraction )

Create a length in percents

  • fraction The fraction of a percent (0 = 0%, 1 = 100%)
  • Returns A new length

public static Nullable<Length> Calc( string expression )

Create a length based on a css calc expression

public static Length Rem( float value )

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

  • value Value in rem
  • Returns A new length

public static Length Em( float value )

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

  • value Value in em
  • Returns A new length

public static Length Auto { get; }

Quickly create a Length with Unit set to LengthUnit.Auto

public static Length Contain { get; }

Quickly create a Length with Unit set to LengthUnit.Contain

public static Length Cover { get; }

Quickly create a Length with Unit set to LengthUnit.Cover

public static Nullable<Length> Parse( string value )

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

  • value A length represented by a string

public static Length op_Implicit( float value )

😔 No documentation found.

public static Length Undefined { get; }

😔 No documentation found.

public bool Equals( Length other )

😔 No documentation found.

public static bool op_Equality( Length lhs, Length rhs )

😔 No documentation found.

public static bool op_Inequality( Length lhs, Length rhs )

😔 No documentation found.

public static bool op_Equality( Nullable<Length> lhs, Nullable<Length> rhs )

😔 No documentation found.

public static bool op_Inequality( Nullable<Length> lhs, Nullable<Length> rhs )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.