DataGrid嵌套多列

muzizongheng
博客专家认证
2010-12-07 08:58:35
现在有一个问题, 我有个嵌套数组, 比如:

class X
{
int count;
List<int> items = new List<int>();
}

List<X> dataSource = new List<X>();

///////////////////////////

我绑定到DataGrid控件, 那它是2列, 我想把items每一项也显示到外面,比如items有ge, 那我显示的列为count, item1, item2, item3;
items有多少就动态显示多少。 但不是rowdetail那种情况。

如何解决?请教高手
...全文
90 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
muzizongheng 2010-12-07
  • 打赏
  • 举报
回复
好冷。。。。
muzizongheng 2010-12-07
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 jimmy_xiao0010 的回复:]
我想到的解决方案是 后台动态创建xaml 也就是一个生成column模板,然后把header和数据都binding到items[i]上
[/Quote]

绑定没有用 , 我也不清楚item的这个和col怎么对应。 毕竟有些item有这个col没有那个col
muzizongheng 2010-12-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 jimmy_xiao0010 的回复:]
可以是可以,但是

List<X> dataSource = new List<X>();

X list中的 items 的count数量不一致怎么办,你想过没
[/Quote]
想过啊。 没有的就是空着。 但我的col肯定是所有item的都出现过的。
helloWorld1209 2010-12-07
  • 打赏
  • 举报
回复
我想到的解决方案是 后台动态创建xaml 也就是一个生成column模板,然后把header和数据都binding到items[i]上
helloWorld1209 2010-12-07
  • 打赏
  • 举报
回复
可以是可以,但是

List<X> dataSource = new List<X>();

X list中的 items 的count数量不一致怎么办,你想过没
passself 2010-12-07
  • 打赏
  • 举报
回复
用dataGrid的子元素,叫colomn好像是

8,734

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧