This section looks at how Blend makes it easy to create a new Windows Phone 7 Form.

Adding Layout Panels

To put controls on a WP7 application page, the first thing you need is a layout panel. When you create a new page in Blend, the Page template already contains a number of components, as shown in Figure 12-4.

FIGURE 12-4: Default controls in a New Page template.


LayoutRoot is a Grid that's the root layout control of the whole Page. It contains two more layout panels: a StackPanel named TitlePanel and a Grid named ContentPanel.

If you're happy to have the page title and the application title at the top of the page, you should go ahead and add your own content to the Grid named ContentPanel. If you want a fullscreen application, you can delete TitlePanel and ContentPanel and add your own content to LayoutRoot.

When you use a StackPanel, the order of its contents is the only thing that affects where the child items are placed. You can change the orientation of a StackPanel, but there are no properties that you need to set on the child items. If you need to rearrange items in a StackPanel, you can either reorder them by dragging them around in the Objects and Timelines panel or by selecting them and then selecting Object image Order Bring Forward or Object Order Send Backward ...

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 live online training, plus books, videos, and digital content from nearly 200 publishers.