224Microsoft Visual Studio 2010: A Beginner’s Guide

Figure 8-5 DockPanel layout

Width properties. Removing the Height and Width properties allows the DockPanel to expand and cover the entire window. Figure 8-5 shows a DockPanel with Label controls in each docking position.

Every time you drag and drop a control onto the design surface of a DockPanel, the control will take the center position by default. To specify where the control should dock, open the Properties window and set the DockLayout.Dock property. When you add a new control, the new control will become the center control and the other control will dock to the side of the DockPanel you specified in the Dock property. The next layout control is WrapPanel.

WrapPanel Layout

Whenever controls should naturally follow each other in sequence and continue wrapping on new lines, you can use a WrapPanel. Examples of when this is useful could be when adding controls that contain text and it’s useful to view the controls in sequence. Figure 8-6 shows several CheckBox controls in a WrapPanel.

Page 247
Image 247
Microsoft 9GD00001 manual WrapPanel Layout, DockPanel layout