Prev | Current Page 210 | Next

Matthew MacDonald

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

ShowGridLines property to True to
take a closer look. This feature isn??™t really intended for prettying up a window. Instead, it??™s a debugging
convenience that??™s designed to help you understand how the Grid has subdivided itself into smaller regions.
This feature is important because you have the ability to control exactly how the Grid chooses column widths
and row heights.
Creating a Grid-based layout is a two-step process. First, you choose the number of
columns and rows that you want. Next, you assign the appropriate row and column to each
contained element, thereby placing it in just the right spot.
You create grids and rows by filling the Grid.ColumnDefinitions and Grid.RowDefinitions
collections with objects. For example, if you decide you need two rows and three columns,
you??™d add the following tags:










...

As this example shows, it??™s not necessary to supply any information in a RowDefinition or
ColumnDefinition element. If you leave them empty (as shown here), the Grid will share the
space evenly between all rows and columns.


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