O'Reilly logo

Microsoft® Silverlight® Edition: Programming Windows® Phone 7 by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Polylines and Custom Curves

The Line element looks simple but the markup is a little bloated. You can actually reduce the markup for drawing a single line by switching from the Line to the Polyline:

<Grid Background="LightCyan">
    <Polyline Points="100 300 200 50"
              Stroke="Blue"
              StrokeThickness="5" />
    <Polyline Points="50 100 300 200"
              Stroke="Red"
              StrokeThickness="30" />
</Grid>
image with no caption

The Points property of the Polyline class is of type PointCollection, a collection of Point objects. In XAML you indicate multiple points by just alternating the X and Y coordinates. You can string out the numbers with spaces between them as I’ve done, or you can clarify the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required