As you can see, the location of each child of the UniformGrid is in the order they are added in the XAML.
Quirks
What happens if you put more children in the UnformGrid then you have cells defined? Interestingly, the panel will still load the children. In the next example there are nine cells and ten children. The margin of the UniformGrid has been modified so that we can see more of the its content.
The following code determines what element is the parent for the 10th button. It proves that the button is a child of the UniformGrid.
Using the UniformGrid in an ItemsPanelTemplate
Naturally you can use a UniformGrid in an ItemsPanelTemplate. This makes it simple to create uniform sized grids of data.
In the following screen shot you can see the penguin image is selected
Requires Free Membership to View
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.
Hannah Smalltree, Editorial Director
This was first published in June 2010