WPF and Silverlight Learning Notes (eight): WPF layout management grid, UniformGrid

Source: Internet
Author: User
Tags silverlight

First, Grid

Grid is a way of organizing controls in tabular form, similar to the GridLayout in Java AWT, but the difference is

You can place multiple controls in each cell of the grid in WPF, but the controls may cascade together

The grid in WPF supports the merging of cells, similar to the rowspan and colspan in table TD in HTML

Rows and columns in grid can customize height and width

There are two ways to do this when setting height and width:

1) height= "60": No "asterisk" indicates a fixed height

2) height= "60*": Plus "asterisk" to indicate "weighted" height, when resizing the form, this height or width will be scaled to the size of the form change

Such as:

1: <Grid>
2:    <Grid.RowDefinitions>
3:     <RowDefinition  Height="60" />
4:     <RowDefinition  Height="202*" />
5:    </Grid.RowDefinitions>
6:    <Grid.ColumnDefinitions>
7:      <ColumnDefinition/>
8:      <ColumnDefinition/>
9:    </Grid.ColumnDefinitions>
10:   <Button  Grid.Column="0" Grid.Row="0"  Height="30"  VerticalAlignment="Top">ButtonA</Button>
11:    <Button Grid.Column="0" Grid.Row="0"  Height="30"  VerticalAlignment="Bottom">ButtonB</Button>
12:   <Button Grid.Column="1"  Grid.Row="0">ButtonC</Button>
13:    <Button Grid.Column="0" Grid.Row="1"  Grid.ColumnSpan="2">ButtonD</Button>
14:  </Grid>

Second, the use of gridsplit segmentation

You can use the Gridsplit control to implement functionality similar to the SplitContainer in a Windows application, combined with a grid control, such as the following application:

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.