Prev | Current Page 207 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

Instead, they??™re used
to shape portions of your interface. For example, you could use a DockPanel to place different
StackPanel and WrapPanel containers in the appropriate regions of a window.
For example, imagine you want to create a standard dialog box with OK and Cancel buttons
in the bottom right-hand corner, and a large content region in the rest of the window.
There are several ways to model this interface with WPF, but the easiest option that uses the
panels you??™ve seen so far is as follows:
1. Create a horizontal StackPanel to wrap the OK and Cancel buttons together.
2. Place the StackPanel in a DockPanel and use that to dock it to the bottom of the
window.
3. Set DockPanel.LastChildFill to True, so you can use the rest of the window to fill in
other content. You can add another layout control here, or just an ordinary TextBox
control (as in this example).
4. Set the margin properties to give the right amount of whitespace.
Here??™s the final markup:

Orientation="Horizontal">



This is a test.

Figure 4-11 shows the rather pedestrian dialog box this creates.


Pages:
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219