December 03, 2013
Gets or sets a Stretch enumeration value that describes how the shape fills its allocated space.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
Dependency property identifier field: StretchProperty
Generally, you do not set the value for a Shape or change it from the shape-specific default. This is because the is adjusted for each type of Shape in such a way that each Shape type's sizing and positioning properties are interpreted in the most intuitive way.
The concept of a for a Shape has to do with its natural size and how the Shape is positioned in layout. Ultimately for the layout system, all objects that render to the screen are rectangles with a width and a height. This is reflected in the presence of the properties Width and Height at the UIElement level in the object model. Some types of Shapes (Ellipse, Rectangle) can have natural sizes that are well represented by these Width and Height properties, and as a result these are the only properties you use to provide the size (although the shape that renders within that natural size is still influenced by other properties such as RadiusX). But other types of Shape such as Line or Path have other specific properties that declare the shape, and in this case the appropriate behavior is to have Width and Height be deterministic properties, calculated based on values you provide for the specific sizing properties, such as the X1, Y1, X2, Y2 of a Line. However, even for a shape like Line, Width and Height are still settable. The for a Shape influences what should happen if Width and Height are deliberately set.
For Ellipse or Rectangle, the default behavior is Fill, because their entire sizing logic is based on the Width and Height. Setting to None for an Ellipse or Rectangle effectively makes it nonrendering.
For the other shapes, the default is None. Setting to other values effectively introduces a transform, which could probably be controlled more efficiently with a true transform if that was a desired effect.