Description
The Fill
field of the ObjectFit
enumeration specifies that the content should be sized to completely fill the element's content box. This sizing method does not preserve the aspect ratio of the content, which means the content may be stretched or compressed to fit the dimensions of the container.
Usage
Use ObjectFit.Fill
when you want the content to occupy the entire space of the container without regard to maintaining its original aspect ratio. This is useful in scenarios where the exact fit of the content to the container is more important than preserving the content's original proportions.
Example
// Example of using ObjectFit.Fill in a UI component
var imageElement = new Image();
imageElement.Style.Set("object-fit", ObjectFit.Fill);
// This will stretch the image to fill the entire content box of the imageElement,
// potentially distorting the image if the aspect ratio of the image and the container differ.