Stretch Property (Shape)
Gets or sets a value that describes how the shape fills its allocated space.
XAML |
<object Stretch="Stretch" .../>
|
Scripting |
value = object.Stretch object.Stretch = value |
Property Value
A value of the Stretch enumeration that specifies the stetch behavior.
This property is read/write. The default value at run time depends on the type of Shape.
Remarks
Generally, you do not set the Stretch value for a Shape. This is because the Stretch 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 Stretch 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 Stretch for a Shape influences what should happen if Width and Height are deliberately set.
For Ellipse or Rectangle, the default Stretch behavior is Fill, because their entire sizing logic is based on the Width and Height. Setting Stretch to None for a Ellipse or Rectangle effectively makes it nonrendering.
For the other shapes, the the default Stretch behavior is None. Setting Stretch to other values effectively introduces a transform, which could probably be controlled more efficiently with a true transform if that was a desired effect. See Silverlight Transforms Overview for more information on transforms.
Applies To
Ellipse, Line, Path, Polygon, Polyline, Rectangle