O'Reilly logo

WPF Programmer's Reference: Windows Presentation Foundation with C# 2010 and .NET 4 by Rod Stephens

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 6. Layout Controls

Layout controls are primarily intended to contain and arrange other controls. They position the controls they contain in different ways to make it easier to design various kinds of user interfaces.

Layout controls are not quite the same as container controls. While all layout controls do contain other controls, the converse is not true: Not all controls that contain other controls arrange those controls in a nontrivial way.

For example, the GroupBox control draws a header and a border around a single child. Because its main purpose is to draw the header and border and because it contains only a single child control, it doesn't really do much arranging.

These non-arranging container controls are described elsewhere. For example, the GroupBox is described in the previous chapter.

Control Overview

The following table briefly lists the controls described in this chapter together with their purposes. You can use this table to help decide which control you need in a particular situation.

Control

Purpose

Canvas

Lets you position child controls explicitly by specifying the distances between their left, top, right, and bottom edges and those of the Canvas.

DockPanel

Docks its children to its edges.

Expander

Displays a header and an icon that the user can click on to show or hide a single child control.

Grid

Displays children in rows and columns. You can also ignore the rows and columns and position children somewhat as you can in a Canvas.

ScrollViewer

Displays a single child in ...

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