robot_2Generated
code_blocksInput

Description

The Cover field of the LengthUnit enum is used to specify that a background image should cover the entire element. This means the image will be stretched and cropped as necessary to ensure that it completely fills the element's background area.

Usage

Use LengthUnit.Cover when you want a background image to fully cover an element, ensuring no empty space is visible. This is particularly useful for creating visually appealing backgrounds where the image should be the focal point and should not be repeated or left with empty spaces.

Example

// Example of using LengthUnit.Cover in a UI element
var backgroundStyle = new Style();
backgroundStyle.BackgroundImage = "url('path/to/image.jpg')";
backgroundStyle.BackgroundSize = LengthUnit.Cover;

// Apply the style to a UI element
var panel = new Panel();
panel.Style = backgroundStyle;