Originally I was not setting the width and height properties, and I was trying to find the bounding box of the item by iterating through each point in its point collection and then determining the width and height from there... which seemed to work, but if I tried to then change the width/height attribute directly the whole thing would bork on me. The width and height were returning NAN.
Turns out what I needed to do was set the Stretch property to "Fill" and then set the width and height accordingly.
Stretch [Fill] = The Shape object's contents are stretched to fill its layout space. Aspect ratio is not preserved.
Layout space = Is the amount of space the Shape is allocated by the layout system, because of either an explicit Width and Height setting or because of its HorizontalAlignment and VerticalAlignment settings.
This means that I could not 'clip' a polygon while still using the stretch property... which makes sense, but my case I want changes to the layout space [height/width] to effect the points inside giving me the stretch operation - so everything is a-ok!
polygon
name="PolyStretch"
points="-10,-1 200,200, -100,10"
fill="Blue"
width="50"
height="50"
stretch="Fill"
MSDN Reference
No comments:
Post a Comment