|
|
<Grid ShowGridLines="true|false" /> <Grid .../> is similar to a Table but is more flexible than its traditional counterpart. Grid allows layering of content, including multiple elements in a single cell, whereas Table does not. Child elements in a Grid can be absolutely positioned relative to the upper-left corner of their cell boundaries. Finally, child elements are added to Grid based on row and column index, while child elements in a Table are declared within its parent cell. Grid is a container for ColumnDefinition, RowDefinition, and elements that are placed by specifying their desired row and column attributes. An example of a Grid with content follows and is evaluated in XamlPad in Figure 10-3: <Grid ShowGridLines="true"> <ColumnDefinition Width="100"/> <ColumnDefinition Width="100"/> <RowDefinition Height="100" /> <RowDefinition Height="25" /> <RowDefinition Height="25" /> <TextBlock Grid.Column="0" Grid.Row="0">Col 0, Row 0</TextBlock> <TextBlock Grid.Column="1" Grid.Row="0">Col 1, Row 0</TextBlock> <TextBlock Grid.Column="0" Grid.Row="1">Col 0, Row 1</TextBlock> <TextBlock Grid.Column="1" Grid.Row="1">Col 1, Row 1</TextBlock> <TextBlock Grid.Column="0" Grid.Row="2">Col 0, Row 2</TextBlock> <TextBlock Grid.Column="1" Grid.Row="2">Col 1, Row 2</TextBlock> </Grid> Figure 10-3. Grid with content and ShowGridLines=trueAttributes
Attached Attributes
|
|
|