Chapter 5. Laying Out Controls

In This Chapter

  • Working with container controls

  • Displaying things in a tabular way

  • Stacking up controls the easy way

  • Laying out controls with absolute positioning using the Canvas control

  • Using the ScrollViewer to view more of the control

  • Using the Viewbox to squeeze controls into a given space

  • Grouping controls together in tabs

  • Docking controls

Designing a good user interface includes paying close attention to how the contents of your screen are organized and laid out. You can lay out the user interface elements using absolute positioning, which means to specify the exact position an element should occupy. This approach is not always practical, however, because your users may have different screen resolutions and may even run the application on a variety of devices. Uh-oh, did we say a variety of devices? Yes, it's true: Remember that Silverlight actually runs on a browser, and the plug-in can be ported to different devices, including mobile phones.

Laying out your controls on your screen with a range of devices in mind therefore presents a challenge. Thankfully, Silverlight contains a range of layout containers — controls that help you manage the way your on-screen controls are laid out. In this chapter, we look at a few of the commonly used containers and how they can be used to control the layout of the screen.

Understanding Layout Containers

A container in Silverlight is simply a control that can contain other user interface elements (or controls). The controls ...

Get Silverlight™ 4 For Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.