The only settable property defined by Shape that I haven’t discussed yet is Stretch. This is similar to the same property in the Image element; you set it to a member of the Stretch enumeration, either None (the default), Fill, Uniform, or UniformToFill. Here’s an innocent little Polygon:
<Grid Background="LightCyan">
<Polygon Points="250 200, 250 210,
230 270, 230 260"
Stroke="Red"
StrokeThickness="4" />
</Grid>
Now here’s the same Polygon with its Stretch property set to Fill.
<Grid Background="LightCyan">
<Polygon Points="250 200, 250 210,
230 270, 230 260"
Stroke="Red"
StrokeThickness="4"
Stretch="Fill" />
</Grid>
Regardless of the
coordinates, it stretches to fill the container with a change in aspect
ratio as well. To retain the aspect ratio, use Uniform or UniformToFill just as with the Image element.
You can probably see why the Stretch property of Shape isn’t used very often in connection with vector graphics, but if you need a particular vector image to fill an area of arbitrary size, it’s a welcome option.