[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Describes how content is resized to fill its allocated space.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
|The content preserves its original size.|
|The content is resized to fill the destination dimensions. The aspect ratio is not preserved.|
|The content is resized to fit in the destination dimensions while it preserves its native aspect ratio.|
|The content is resized to fill the destination dimensions while it preserves its native aspect ratio. If the aspect ratio of the destination rectangle differs from the source, the source content is clipped to fit in the destination dimensions.|
The following illustration shows the different values. Keep in mind that different Panel containers and different layout properties (such as VerticalAlignment and HorizontalAlignment) can affect the final rendering. This illustration is of an Image object in a Grid with VerticalAlignment and HorizontalAlignment set to Center.
Although unintuitive, in some cases you can get better performance by setting Stretch properties to instead of other values, including . When you use Stretch = Fill, there is no potential clipping happening which adds extra edges. Any other type of stretch besides needs to compute layout (e.g. compute centering). You will probably not notice the difference unless you are rendering a lot of images.