Image.Stretch Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
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)
Syntax
'Declaration
Public Property Stretch As Stretch
public Stretch Stretch { get; set; }
<Image Stretch="stretchValue"/>
XAML Values
- stretchValue
A named constant of the Stretch enumeration, such as Uniform.
Property Value
Type: System.Windows.Media.Stretch
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.
Remarks
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.
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.