Stretch (Image)


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

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.

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.

Community Additions