Grid

Grid is the most versatile panel and probably the one you’ll use most often. (Visual Studio projects use Grid by default, even when you create a blank 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 6.2 uses Grid to build a user interface somewhat like the Windows 8.x Start screen. It defines a 7x8 Grid and arranges children in many of its cells.

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

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

Get XAML 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.