2010-09-28 87 views
0

这种情况:如何在wpf中的listview项目中创建动态gridview

我有一个listview与一些项目。这些项目中的每一个都有另一个列表,我想在gridview中显示这个列表。

所以我想展示与扩展器的主要列表视图,如果用户展开这个项目之一,它会显示在gridview中的另一个列表。

问题是,gridview必须是动态的,因为该项目的属性是动态的。

你可以给我一些想法,如何创建一个列表视图项目中的动态列的GridView。

有一个例证:d:

Mainlist与膨胀剂:

- > mainitem1
- > mainitem2(这已展开:))

Column1 Column2 Column3 
property1 property2 property3 (other list first item properties) 
property1 property2 property3 (other list second item properties) 
property1 property2 property3 (other list third item properties) 
property1 property2 property3 (other list fourth item properties) 

- > mainitem3

我希望你明白它:)。

在此先感谢您的每一条评论!

问候, 佐利

回答

0

我会建议使用WPF的DataGrid。

您可以将它用于整个解决方案,或者只是内部的ListView可以是DataGrid。 DataGrid可以自动为您生成列,并且可以将其设置为只读,因此它的行为与ListView相似。

+0

谢谢,它解决了我的问题,但我必须创建AutoGeneratedColumn事件,因为我的属性在列表中,并且我必须动态地将列添加到代码隐藏的数据网格中。 – 2010-09-30 16:31:33