08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 16 ■ PROGRAMMING SILVERLIGHT WITH XAML AND JAVASCRIPT 391<br />

In addition to using geometries, the Path object can be specified using a string that<br />

contains what is called the path language. This uses a simple syntax of space-separated<br />

values. These values contain a comm<strong>and</strong> letter, followed by a space, followed by a<br />

comma-separated set of numbers, which are the parameters for the specified comm<strong>and</strong>.<br />

Here’s an example:<br />

<br />

In this example, the M comm<strong>and</strong> (for move) moves the drawing head to position<br />

(10,10), <strong>and</strong> the L comm<strong>and</strong> (for draw line) draws a line to position (150,150).<br />

The full set of path language comm<strong>and</strong>s are as follows:<br />

M: Moves the draw heads to the point specified by two double values<br />

L: Draws a line to the point specified by two double values<br />

H: Draws a horizontal line to the point specified by a double value for its endpoint on x<br />

V: Draws a vertical line to the point specified by a double value for its endpoint on y<br />

C: Draws a cubic Bézier curve between the current point <strong>and</strong> the endpoint specified<br />

by six double values, which specify the x <strong>and</strong> y points of the two control points of the<br />

curve <strong>and</strong> the endpoint for the curve<br />

Q: Draws a quadratic Bézier curve between the current point <strong>and</strong> the endpoint, specified<br />

by four double values, with the first two being the x <strong>and</strong> y of the curve’s control<br />

point <strong>and</strong> the latter two being the x <strong>and</strong> y of the endpoint<br />

S: Very similar to the Q comm<strong>and</strong> in that it takes four parameters, but draws the curve<br />

slightly differently, as the current coordinates are also used as a control point<br />

A: Draws an elliptical arc between the current point <strong>and</strong> the endpoint<br />

Z: Ends the current path <strong>and</strong> closes it by drawing a line between the current point<br />

<strong>and</strong> the overall starting point of this path<br />

XAML Controls<br />

In addition to the shapes, brushes, <strong>and</strong> visual elements mentioned previously, <strong>Silverlight</strong><br />

has a number of XAML controls. These include the following:<br />

• Image<br />

• Glyphs

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!