StackPanel and Grid cross-use

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.