Tuesday, March 19, 2013

Where is my table element?

The closest you're going to get to the table element is the Grid panel.

Simple Comparison 

HTML:

<table>
    <tr>
        <td>Stuff</td>
    </tr>
</table>

XAML:

<Grid>
    <TextBlock Text="Stuff"></TextBlock>
</Grid>

By default the XAML Grid has one row and one column. You can actually add more objects inside the grid but they will all be overlapping.

More Complex Comparison 

HTML:

<table>
    <tr>
        <td>Stuff in row 1</td>
    </tr>
    <tr>
        <td>Stuff in row 2</td>
    </tr>

</table>

XAML:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>
    <TextBlock Grid.Row="0" Text="Stuff in row 1"></TextBlock>
    <TextBlock Grid.Row="1" Text="Stuff in row 2"></TextBlock>
</Grid>

No comments:

Post a Comment