Universal Windows Platform – Tutorial Insider – Uniform Control


comentsys.wordpress.com today features a Universal Windows Platform tutorial showing how to create Uniform Control, which is a panel where all the elements are sized the same way based from the first item in the panel.


The Uniform Class Inherits the Panel class and then has Columns, FirstColumn and Rows properties. The UpdateComputedValues method gets the Columns and Rows and adjusts the layout accordingly based on the Visibility of the elements to produce the correct number of Rows and Columns needed. ArrangeOverride respnds to Size changes that require the layout to be updated and arranges these based from a Rect from the Width and Height plus the number of rows and columns. MeasureOverride returns a Size by first using UpdateComputedValues then setting the Available size and then resizing each Child of the control to be the desired Size value.

Behind the Scenes

Uniform Control is based off the Uniform Grid in the WinRTXamlToolkit by Filip Skakun and is quite a useful control to have, in the example all the other items in the control are sized based from the initial element so they all have a uniform size – this makes it easy to create proportional layouts with the correct spacing based on the largest elements, something that might come in useful when creating applications.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s