Powerful though the Grid is, it's occasionally a little cumbersome to use. There's a simplified version worth knowing about, called UniformGrid. All its cells are the same size, so you don't need to provide collections of row and column descriptions—just set the Rows and Columns properties to indicate the size. In fact, you don't even need to set these—by default, it creates rows and columns automatically. It always keeps the number of rows and columns equal to each other, adding as many as are required to make space for the children. Each cell contains just one child, so you do not need to add attached properties indicating which child belongs in which cell—you just add children. This means you can use something as simple as Example 3-17.
Example 3-17. UniformGrid
<TextBlock Text="X" /> <TextBlock Text="O"/> <TextBlock Text="X"/> <TextBlock Text="X"/> <TextBlock Text="X"/> <TextBlock Text="O"/> <TextBlock Text="O"/> <TextBlock Text="O"/> <TextBlock Text="X"/> </UniformGrid>
This contains nine elements, so the UniformGrid will create three rows and three columns. Figure 3-20 shows the result.
xox xxo oox
Figure 3-20. UniformGrid
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.