Length
public sealed struct 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.
Properties
Methods
Single GetPixels(Single dimension) Convert to a pixel value. Use the dimension to work out percentage values.
Single GetPixels(Single dimension, Single contentSize) Get the pixel size but also evaluate content size to support use Start, End, Center
static Length? Pixels(Single pixels) Create a length in pixels
pixels — The amount of pixels for this length static Length? Percent(Single percent) Create a length in percents
percent — The amount of percent for this (0-100) static Length? ViewHeight(Single percentage) Create a length based on the view height
percentage — The amount of percent for this (0-100) static Length? ViewWidth(Single percentage) Create a length based on the view width
percentage — The amount of percent for this (0-100) static Length? ViewMax(Single percentage) Create a length based on the longest edge of the screen size
percentage — The amount of percent for this (0-100) static Length? ViewMin(Single percentage) Create a length based on the shortest edge of the screen size
percentage — The amount of percent for this (0-100) static Length? Fraction(Single fraction) Create a length in percents
fraction — The fraction of a percent (0 = 0%, 1 = 100%) static Length? Calc(String expression) Create a length based on a css calc expression
static Length Rem(Single value) Create a length based on the font size of the root element.
value — Value in rem static Length Em(Single value) Create a length based on the font size of the current element.
value — Value in em static Length? Parse(String value) Parse a length. This is used by the stylesheet parsing system.
value — A length represented by a string Fields
| Name | Type | Description |
|---|---|---|
Value | Single | The meaning of the value is dependent on Unit. |
Unit | LengthUnit | How to determine the final length. Commonly used with Pixel or Percentage. |