Today, experiment with StackPanel and grid together, began to build a StackPanel, the StackPanel occupy the space, in order to achieve this effect, the width is set to 500.
Built a grid inside the first StackPanel. Three row definitions and two column definitions were built in the grid.
Put the Title1 in the default position, and the text is placed in grid.row= "1" grid.column= "1". Since the start definition is 0.
The color block is placed in grid.row= "2" grid.column= "1". Set a copy of the three copies, change the color can be. The equivalent of 3 grids built in the first StackPanel.
Here's the code:
<stackpanel width= "$" margin= "20,0,0,0" horizontalalignment= "left" >
<grid margin= "0,0,0,20" >
<Grid.RowDefinitions>
<rowdefinition/>
<rowdefinition/>
<rowdefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<columndefinition width= "1*"/>
<columndefinition width= "/>"
</Grid.ColumnDefinitions>
<textblock fontsize= ">Title1</TextBlock>"
<textblock grid.row= "1" grid.column= "1" textwrapping= "Wrap" >
The novel is described in first person, narrator Marcel suffers from severe insomnia, often in the state of half asleep, sickly and sensitive when young. At the beginning of the novel, the protagonist recalls the fragments of life in Gombre's childhood. One summer evening, the neighbour, Mr. Swan, was not accompanied by Mrs. Swan Odetta, who came to visit the narrator's parents. The narrator couldn't wait for his mother's kiss before he went to bed, and he felt very uncomfortable.
</TextBlock>
<stackpanel orientation= "Horizontal" grid.row= "2" grid.column= "1" >
<rectangle fill= "Blue" width= "height="/>
<rectangle fill= "Black" width= "height="/>
<rectangle fill= "Green" width= "height="/>
</StackPanel>
</Grid>
<grid margin= "0,0,0,20" >
<Grid.RowDefinitions>
<rowdefinition/>
<rowdefinition/>
<rowdefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<columndefinition width= "1*"/>
<columndefinition width= "/>"
</Grid.ColumnDefinitions>
<textblock fontsize= ">Title2</TextBlock>"
<textblock grid.row= "1" grid.column= "1" textwrapping= "Wrap" >
The novel is described in first person, narrator Marcel suffers from severe insomnia, often in the state of half asleep, sickly and sensitive when young. At the beginning of the novel, the protagonist recalls the fragments of life in Gombre's childhood. One summer evening, the neighbour, Mr. Swan, was not accompanied by Mrs. Swan Odetta, who came to visit the narrator's parents. The narrator couldn't wait for his mother's kiss before he went to bed, and he felt very uncomfortable.
</TextBlock>
<stackpanel orientation= "Horizontal" grid.row= "2" grid.column= "1" >
<rectangle fill= "Blue" width= "height="/>
<rectangle fill= "Yellow" width= "" height= "/>"
<rectangle fill= "Green" width= "height="/>
</StackPanel>
</Grid>
<grid margin= "0,0,0,20" >
<Grid.RowDefinitions>
<rowdefinition/>
<rowdefinition/>
<rowdefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<columndefinition width= "1*"/>
<columndefinition width= "/>"
</Grid.ColumnDefinitions>
<textblock fontsize= ">Title3</TextBlock>"
<textblock grid.row= "1" grid.column= "1" textwrapping= "Wrap" >
The novel is described in first person, narrator Marcel suffers from severe insomnia, often in the state of half asleep, sickly and sensitive when young. At the beginning of the novel, the protagonist recalls the fragments of life in Gombre's childhood. One summer evening, the neighbour, Mr. Swan, was not accompanied by Mrs. Swan Odetta, who came to visit the narrator's parents. The narrator couldn't wait for his mother's kiss before he went to bed, and he felt very uncomfortable.
</TextBlock>
<stackpanel orientation= "Horizontal" grid.row= "2" grid.column= "1" >
<rectangle fill= "Blue" width= "height="/>
<rectangle fill= "Red" width= "height="/>
<rectangle fill= "Green" width= "height="/>
</StackPanel>
</Grid>
</StackPanel>
</Page>
StackPanel and Grid cross-use