CHAPTER 3 EXERCISE SOLUTIONS

Exercise 1 Solution

False. By default, you can use HTML color codes only when declaring brushes in XAML. If you need to use HTML color codes in the code-behind file, you have to create a custom conversion method that parses the color code into red, green, and blue components and then pass those into the Color.FromARGB method.

Exercise 2 Solution

Choices a and b are not valid shape objects in Silverlight. Silverlight provides the Rectangle, Polyline, Polygon, Path, Ellipse, and Line objects for drawing various shapes on the screen.

Exercise 3 Solution

When you use the TransformGroup object, the order in which transform effects are added matters. The transforms will be applied to the target object in the order in which the effects are added to the group.

Exercise 4 Solution

When you need a way to repeat a task on a timed basis, you should always use the DispatcherTimer object. This ensures that the repeated task will not interfere at all with the main user interface, and it also gives you the ability to run custom code during every Tick event.

Exercise 5 Solution

Choices c, e, and f are not valid transform effects. Silverlight provides the RotateTransform, SkewTransform, ScaleTransform, and TranslateTransform effects.

Get Beginning Windows® Phone 7 Application Development: Building Windows® Phone Applications Using Silverlight® and XNA® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.