.NET的winform中listview的绑定
private void FrmXMLShow_Load(object sender, EventArgs e){
// listview样式设置
listView1.GridLines = true;
listView1.FullRowSelect = true;
listView1.View = View.Details;
listView1.Scrollable = false;
listView1.MultiSelect = false;
listView1.HeaderStyle = ColumnHeaderStyle.Clickable;
// 表头设置
listView1.Columns.Add("ID", 50, HorizontalAlignment.Center);
listView1.Columns.Add("姓名", 50, HorizontalAlignment.Center);
listView1.Columns.Add("性别", 50, HorizontalAlignment.Center);
listView1.Columns.Add("年龄", 50, HorizontalAlignment.Center);
listView1.Columns.Add("学校", 150, HorizontalAlignment.Center);
listView1.Columns.Add("联系电话", 150, HorizontalAlignment.Center);
foreach (Information i in ixs.ReadAllInformation())
{
ListViewItem item = new ListViewItem();
item.SubItems.Clear();
item.Text = i.Id;
item.SubItems.Add(i.Name);
item.SubItems.Add(i.Gender);
item.SubItems.Add(i.Age.ToString());
item.SubItems.Add(i.University);
item.SubItems.Add(i.Phone);
listView1.Items.Add(item);
}
}
摘自 徐越的专栏
补充:Web开发 , ASP.Net ,