Share via


Stretch (Image)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that specifies how an Image should be stretched to fill a destination rectangle.

<object Stretch="Stretch"  .../>
value = object.Stretch
object.Stretch = value

Property Value

Type: Stretch

One of the enumeration values that specifies how the source image is applied if the Height and Width of the Image are specified and are different from the height and width of the source image.

This property is read/write. The default value is Uniform.

Managed Equivalent

Stretch

Remarks

A value of Fill will cause your image to stretch to completely fill the output area. When the output area and the image have different aspect ratios, the image is distorted by this stretching. To make an Image preserve the aspect ratio of the image, set the Stretch property to Uniform (the default) or UniformToFill. Alternatively, you can leave the Height and Width of the Image unset, which will display the image source at its true resolution. However, this results in loss of control over the element sizing in XAML.

Applies To

Image

See Also

Reference