#404 – A Grid Hosts Child Controls in Rows and Columns
October 10, 2011 3 Comments
A Grid is a layout container that positions its child elements into a series of rows and columns. You specify the number of rows and columns, along with information about their size, in the Grid tag. You then specify which row and column each control is located in using the Grid.Row and Grid.Column attached properties.
Rows are numbered top to bottom, starting at 0. Columns are numbered left to right, starting at 0.
<Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Label Grid.Row="0" Grid.Column="0" Content="Upper left"/> <Label Grid.Row="0" Grid.Column="1" Content="Upper right"/> <Label Grid.Row="1" Grid.Column="0" Content="Lower left"/> <Label Grid.Row="1" Grid.Column="1" Content="Lower right"/> </Grid>
Pingback: Dew Drop – October 10, 2011 | Alvin Ashcraft's Morning Dew
Pingback: #405 – Default Values for Grid.Row and Grid.Column Properties « 2,000 Things You Should Know About WPF
Pingback: #578 – Grid Row and Column Size Use GridLength Object « 2,000 Things You Should Know About WPF