LengthUnit ViewMax

robot_2Generated
code_blocksInput

Description

The ViewMax field of the LengthUnit enum represents a length unit that is a percentage (0-100) of the viewport's largest side or edge. This is useful for responsive design, allowing elements to scale based on the larger dimension of the viewport, whether it be width or height.

Usage

Use LengthUnit.ViewMax when you want an element's size to be relative to the largest dimension of the viewport. This can be particularly useful for ensuring that elements maintain a consistent aspect ratio or size relative to the overall screen size, regardless of whether the screen is in portrait or landscape orientation.

Example

// Example of using LengthUnit.ViewMax in a UI component
var myElement = new UIElement();
myElement.Width = new Length(50, LengthUnit.ViewMax); // Sets the width to 50% of the viewport's largest side
myElement.Height = new Length(25, LengthUnit.ViewMax); // Sets the height to 25% of the viewport's largest side