如這兩幅圖所示:如果要顯示左邊的豎線,需要設置
感謝 DoomGuards
本節Dome下載地址:http://pan.baidu.com/s/1wBOJk 密碼:vz4d
DataTable dtTree = new DataTable(); dtTree.Columns.Add("ID",typeof(string)); dtTree.Columns.Add("Code", typeof(string)); dtTree.Columns.Add("Name", typeof(string)); dtTree.Columns.Add("Description", typeof(string)); dtTree.Columns.Add("ParentID", typeof(string)); //新增加的列 布爾類型才能綁定checkbox dtTree.Columns.Add("Tag", typeof(bool)); dtTree.Columns.Add("Happy", typeof(string));
DataRow row = dtTree.NewRow(); row["ID"] = "1"; row["Code"] = "001"; row["Name"] = "野原廣志"; row["Description"] = "野原廣志"; row["ParentID"] = "-1"; row["tag"] = false; row["Happy"] = "愛吃青椒"; dtTree.Rows.Add(row);
DataRow row2 = dtTree.NewRow(); row2["ID"] = "2"; row2["Code"] = "002"; row2["Name"] = "野原美呀"; row2["Description"] = "野原美呀"; row2["ParentID"] = "-1"; row2["tag"] = false; row2["Happy"] = "愛吃青椒"; dtTree.Rows.Add(row2);
DataRow row3 = dtTree.NewRow(); row3[......余下全文>>
如果你的數據源是datatable可以用ColumnChanged事件改變值,不然可以對列設置ColumnEdit然後通過EditValueChanged來設置。