简体   繁体   English

如何联合Grid的行或列

[英]How to unite rows or columns of Grid

I have grid container. 我有网格容器。 Grid has cells. 网格有细胞。 I need unite some cells in the grid. 我需要在网格中联合一些单元格。 How can achive it? 如何实现呢? 在此输入图像描述

The above image shows where I want to add cells. 上图显示了我想要添加单元格的位置。

if you want to merge all cells in individual rows you can use colunnSpan.. something like this 如果你想合并单个行中的所有单元格,你可以使用colunnSpan ..这样的东西

<Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Button Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="2"></Button>
    </Grid>

You cannot merge the cells but you can have the item in a cell span multiple adjacent cells. 您无法合并单元格,但可以让单元格中的项目跨越多个相邻单元格。

<TextBox Grid.RowSpan="2"/>

This will allow the text box to expand to the cell below the current cell. 这将允许文本框扩展到当前单元格下方的单元格。

Similarly there is a ColSpan property to stretch to other columns. 类似地,有一个ColSpan属性可以拉伸到其他列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM