October 11, 2011 Leave a comment
You normally specify values for the Grid.Row and Grid.Column properties for each child element of a grid, indicating the cell in the grid where you’d like the child element positioned.
If you do not specify a value for either the Grid.Row or the Grid.Column properties, a value of 0 will be used for that property. This places the element into the first row and/or first column, respectively.
In the example below, we’ve created a grid that has two rows and two columns. We’ve mistakenly left off the Grid.Row and Grid.Column properties for the two child elements and so they have both been placed into the first row and first column.
<Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Button Content="Push Me" Width="100" /> <Label Content="Oops I'm in the same cell with a button !" /> </Grid>