对datagrid中的rowpan有任何想法吗? [英] Any ideas for rowspan in datagrid?
本文介绍了对datagrid中的rowpan有任何想法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好.
我需要具有10列的WPF DataGrid,其中5-10列在该行中有多个子行.看起来应该像这样
Hello.
I need WPF DataGrid with 10 columns, where columns 5-10 have more than one subrow in the row. It should look like this
col1| col2 | col3 |
----|--------|--------|
row1|subrow1 |subrow1 |
|--------|--------|
|subrow2 |subrow2 |
----|--------|--------|
row2|subrow21|subrow21|
|--------|--------|
|subrow22|subrow22|
|--------|--------|
|subrow22|subrow22|
----|--------|--------|
...
等
有什么想法可以实现吗?
谢谢.
etc.
Any ideas how can i achieve that?
Thanks.
推荐答案
这实际上非常简单:
That is actually very easy:
<grid>
<grid.columndefinitions>
<columndefinition width="100" />
<columndefinition width="100" />
<columndefinition width="100" />
</grid.columndefinitions>
<grid.rowdefinitions>
<rowdefinition height="25" />
<rowdefinition height="25" />
<rowdefinition height="25" />
<rowdefinition height="25" />
<rowdefinition height="25" />
</grid.rowdefinitions>
<border grid.column="0">
Grid.Row="0"
Grid.RowSpan="2"
BorderThickness="1"
BorderBrush="Black"
Padding="3">
<textblock text="Row1" />
</border>
<border grid.column="0">
Grid.Row="2"
Grid.RowSpan="2"
BorderThickness="1"
BorderBrush="Black"
Padding="3">
<textblock text="Row2" />
</border>
<border grid.column="1">
Grid.Row="0"
BorderThickness="1"
BorderBrush="Black"
Padding="3">
<textblock text="SubRow1" />
</border>
<border grid.column="1">
Grid.Row="1"
BorderThickness="1"
BorderBrush="Black"
Padding="3">
<textblock text="SubRow2" />
</border>
</grid>
这篇关于对datagrid中的rowpan有任何想法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文