We've been working on some new controls and while developing one in particular that we'll post about next time, we had a need for a UniformGrid panel. The UniformGrid panel is already available in native WPF, but isn't available in WinRT/XAML or Silverlight.
For the next maintenance releases of our WinRT/XAML and Silverlight controls, we rolled our own UniformGrid that has the same properties as the WPF version, making it easy to reuse code across platforms.
The UniformGrid automatically lays out items in a grid such that the row and column counts are the same, and each item in the panel has the same size.
In this screenshot, the panel has four items in it. Thus a 2x2 grid is created to display them all.
In this screenshot, we have seven items so a larger grid is necessary. A 3x3 grid is used instead.
You also have the option to specify a certain number of rows or columns that should be used.
In this screenshot, we have specified that two columns should be used. The panel therefore creates a 2x4 grid (two columns and four rows). Note that regardless of layout, items always appear in the same size.
You can see that UniformGrid provides for a lot of interesting layout scenarios, especially when you tell it a certain number of rows or columns to use.
Our next blog post will show off another new control coming to our XAML platforms that makes use of this new panel.