Description
The ObjectFit
property in the Sandbox.UI.BaseStyles
class represents the object-fit
CSS property. This property specifies how the content of a replaced element, such as an image or video, should be resized to fit its container. It is a nullable property of type Sandbox.UI.ObjectFit
, allowing for various fitting options such as fill
, contain
, cover
, none
, and scale-down
.
Usage
To use the ObjectFit
property, you can set it to one of the values defined in the Sandbox.UI.ObjectFit
enumeration. This will determine how the content should be resized within its container. If not set, the default behavior will be applied.
Example
// Example of setting the ObjectFit property
var styles = new BaseStyles();
styles.ObjectFit = ObjectFit.Cover; // The content will cover the entire container, maintaining its aspect ratio.