wpf A simple Grid


Example

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Column="1" Text="abc"/>
    <TextBlock Grid.Row="1" Grid.Column="1" Text="def"/>
</Grid>

Rows and columns are defined adding RowDefinition and ColumnDefinition elements to the corresponding collections.

There can be an abitrary amount of children in the Grid. To specify which row or column a child is to be placed in the attached properties Grid.Row and Grid.Column are used. Row and column numbers are zero based. If no row or column is set it defaults to 0.

Children placed in the same row and column are drawn in order of definition. So the child defined last will be draw above the child defined before.