O'Reilly logo

Beginning Windows® Phone 7 Application Development: Building Windows® Phone Applications Using Silverlight® and XNA® by Robert Fonseca-Ensor, Karli Watson, Nick Lecrenski

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

CHAPTER 2 EXERCISE SOLUTIONS

Exercise 1 Solution

The correct answer is False. You can easily support both portrait and landscape orientations in your applications by modifying the SupportedOrientation and Orientation properties of the PhoneApplicationPage control. Valid values for SupportedOrientation are Landscape, Portrait, and PortraitOrLandscape. The Orientation property should be set to the screen orientation you want to be the default when the application starts up.

Exercise 2 Solution

The answer is c (GroupName). When using several RadioButton controls on a page, you should set the GroupName property to be the same for all the RadioButton controls that you want to be a part of the mutually exclusive group. Then, when a user clicks a given RadioButton control, the currently selected control will automatically become unselected.

Exercise 3 Solution

Although there are a couple of ways to accomplish vertical and horizontal layouts, the StackPanel control provides the easiest way to do so. You can accomplish a similar layout by using a Grid or Canvas control, but doing so requires much more code than does using a simple StackPanel declaration. With the StackPanel control, you just set the Orientation property and add controls. No other work is necessary. On the other hand, with a Grid control, you need to add RowDefinition or ColumnDefinition objects for each control you're trying to display.

Exercise 4 Solution

When you want to launch the internal web browser on the phone and ...

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