我正在尝试将ListView项目放在我的ListView中,它与GridView对象分隔成列。
我不知道如何在列中添加新项目,并且网上没有那么多有用的教程。
这是ListView的XAML代码:
<ListView Canvas.Left="200" Canvas.Top="68" Height="138" Name="listView1" Width="444">
</ListView>
GridView是动态创建的:
public MainWindow()
{
InitializeComponent();
GridView grdView = new GridView();
GridViewColumn nameColumn = new GridViewColumn();
nameColumn.DisplayMemberBinding = new Binding("Time");
nameColumn.Header = "Time";
nameColumn.Width = 120;
grdView.Columns.Add(nameColumn);
GridViewColumn ageColumn = new GridViewColumn();
ageColumn.DisplayMemberBinding = new Binding("Date");
ageColumn.Header = "Date";
ageColumn.Width = 120;
grdView.Columns.Add(ageColumn);
listView1.View = grdView;
}
我想在ListView中添加一些项目,怎么做?