Prev | Current Page 216 | Next

Matthew MacDonald

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

You simply
need to know that the Width and Height properties are GridLength objects. To create a GridLength that
represents a specific size, just pass the appropriate value to the GridLength constructor. To create a
GridLength that represents a proportional (*) size, pass the number to the GridLength constructor, and pass
GridUnitType.Start as the second constructor argument. To indicate automatic sizing, use the shared property
GridLength.Auto.
Using these size modes, you can duplicate the simple dialog box example shown in
Figure 4-11 using a top-level Grid container to split the window into two rows, rather than
a DockPanel. Here??™s the markup you??™d need:





This is a test.
CHAPTER 4 n LAYOUT 97





nTip This Grid doesn??™t declare any columns. This is a shortcut you can take if your Grid uses just one
column and that column is proportionately sized (so it fills the entire width of the Grid).


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