wpf – 如何将网格行拆分成两列?

我有3行的网格布局.我如何将第3行拆分成2列.

<Grid.RowDefinitions>
    <RowDefinition Height="0.75*"/>
    <RowDefinition Height="0.25*"/>
    <RowDefinition Height="36"/>
</Grid.RowDefinitions>
两种方法可以做到:

>使用嵌套布局.在第三行放置另一个网格,并在该子网格中有两列.

<Grid>
    <Grid.RowDefinitions> ... </Grid.RowDefinitions>
    <ThingInFirstRow Grid.Row="0" />
    <ThingInSecondRow Grid.Row="1" />
    <Grid Grid.Row="2">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <ThingInLowerLeft Grid.Column="0" />
        <ThingInLowerRight Grid.Column="0" />
    </Grid>
</Grid>

>粘贴一个网格,给它两列,并使前两行的东西横跨两列使用ColumnSpan.

<Grid>
    <Grid.RowDefinitions> ... </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <ThingInFirstRow Grid.Row="0" Grid.ColumnSpan="2" />
    <ThingInSecondRow Grid.Row="1" Grid.ColumnSpan="2" />
    <ThingInLowerLeft Grid.Row="2" Grid.Column="0" />
    <ThingInLowerRight Grid.Row="2" Grid.Column="1" />
</Grid>
http://stackoverflow.com/questions/9040535/how-to-split-a-grid-row-into-two-columns

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:wpf – 如何将网格行拆分成两列?