Prev | Current Page 214 | Next

Matthew MacDonald

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

(You can edit the
RowDefinitions and ColumnDefinitions collections using the Properties window.) Once you??™ve set up the Grid,
you can drag and drop the elements you want into the Grid and configure their margin and alignment settings
in the Properties window or by editing the XAML by hand.
Fine-Tuning Rows and Columns
If the Grid were simply a proportionately sized collection of rows and columns, it wouldn??™t be
much help. Fortunately, it??™s not. To unlock the full potential of the Grid, you can change the
way each row and column is sized.
The Grid supports three sizing strategies:
??? Absolute sizes. You choose the exact size using device-independent units. This is the
least useful strategy because it??™s not flexible enough to deal with changing content size,
changing container size, or localization.
??? Automatic sizes. Each row or column is given exactly the amount of space it needs, and
no more. This is one of the most useful sizing modes.
??? Proportional sizes. Space is divided between a group of rows or columns. This is the
standard setting for all rows and columns. For example, in Figure 4-12 you??™ll see that all
cells increase in size proportionately as the Grid expands.
CHAPTER 4 n LAYOUT 96
For maximum flexibility, you can mix and match these different sizing modes. For
example, it??™s often useful to create several automatically sized rows and then let one or two
remaining rows get the leftover space through proportional sizing.


Pages:
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226