Prev | Current Page 226 | Next

Matthew MacDonald

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

The leftmost column of the first Grid is sized proportionately to
fit its content (a long text string). The leftmost column of the second Grid has exactly the same
width, even though it contains less content. That??™s because it shares the same size group. No
matter how much content you stuff in the first column of the first Grid, the first column of the
second Grid stays synchronized.
As this example demonstrates, a shared column can be used in otherwise different grids.
In this example, the top Grid has an extra column, and so the remaining space is divided differently.
Similarly, the shared columns can occupy different positions, so you could create a
relationship between the first column in one Grid and the second column in another. And
obviously, the columns can host completely different content.
Figure 4-15. Two grids that share a column definition
When you use a shared size group, it??™s as if you??™ve created one column (or row) definition,
which is reused in more than one place. It??™s not a simple one-way copy of one column to
another. You can test this out with the previous example by changing the content in the shared
column of the second Grid. Now, the column in the first Grid will be lengthened to match
(Figure 4-16).
You can even add a GridSplitter to one of the Grid objects.


Pages:
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238