Prev | Current Page 237 | Next

Matthew MacDonald

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

With this low-level knowledge in mind, it??™s worth looking at a few complete layout
examples. Doing so will give you a better sense of how the various WPF layout concepts (such
as size-to-content, stretch, and nesting) work in real-world windows.
A Column of Settings
Layout containers such as the Grid make it dramatically easier to create an overall structure to
a window. For example, consider the window with settings shown in Figure 4-20. This window
arranges its individual components??”labels, text boxes, and buttons??”into a tabular structure.
CHAPTER 4 n LAYOUT 111
Figure 4-20. Folder settings in a column
To create this table, you begin by defining the rows and columns of the grid. The rows are
easy enough??”each one is simply sized to the height of the containing content. That means
the entire row will get the height of the largest element, which in this case is the Browse button
in the third column.







...
Next, you need to create the columns. The first and last columns are sized to fit their content
(the label text and the Browse button, respectively).


Pages:
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249