Stretch Property
Collapse the table of content
Expand the table of content

Image.Stretch Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

public Stretch Stretch { get; set; }
<Image Stretch="stretchValue"/>

XAML Values


A named constant of the Stretch enumeration, such as Uniform.

Property Value

Type: System.Windows.Media.Stretch
A value of the enumeration that specifies how the source image is applied if the Height and Width of the Image are specified and are different than the source image's height and width.
The default value is Uniform.

Dependency property identifier field: StretchProperty

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 this property to Uniform (the default) or UniformToFill. Alternatively, you can leave Height and Width of the Image unset, which will display the image source at its true resolution, although this results in loss of control over the element sizing in XAML.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2018 Microsoft