Prev | Current Page 215 | Next

Matthew MacDonald

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


You set the sizing mode using the Width property of the ColumnDefinition object or the
Height property of the RowDefinition object to a number. For example, here??™s how you set an
absolute width of 100 device-independent units:

To use automatic sizing, you use a value of Auto:

Finally, to use proportional sizing, you use an asterisk (*):

This syntax stems from the world of the Web, where it??™s used with HTML frames pages. If
you use a mix of proportional sizing and other sizing modes, the proportionally sized rows or
columns get whatever space is left over.
If you want to divide the remaining space unequally, you can assign a weight, which you
must place before the asterisk. For example, if you have two proportionately sized rows and
you want the first to be half as high as the second, you could share the remaining space like
this:


This tells the Grid that the height of the second row should be twice the height of the first
row. You can use whatever numbers you like to portion out the extra space.
nNote It??™s easy to interact with ColumnDefinition and RowDefinition objects programmatically.


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