Grid

Grid is the most versatile panel and probably the one you’ll use most often. (Visual Studio and Blend use Grid by default, even when you create a Blank App project.) It enables you to arrange its children in a multirow and multicolumn fashion, and it provides a number of features to control the rows and columns in interesting ways. Working with Grid is like working with a table or CSS grid in HTML.

Listing 4.2 uses Grid to build a user interface somewhat like the Start screen in Windows 8.x. It defines a 7x8 Grid and arranges children in many of its cells.

LISTING 4.2 First Attempt at a Start Screen Clone Using a Grid

<Grid Background="#1D1D1D">   <!-- Define seven rows: -->   < Grid.RowDefinitions >      ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.