toolbar可以添加listview吗

 我来答
王睿琦wrq6
2016-09-23 · 超过206用户采纳过TA的回答
知道小有建树答主
回答量:682
采纳率:0%
帮助的人:127万
展开全部

toolbar可以添加listview

          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["ID"] = "3";
            row3["Code"] = "003";
            row3["Name"] = "野原新之助";
            row3["Description"] = "野原新之助";
            row3["ParentID"] = "-1";
            row3["tag"] = false;
            row3["Happy"] = "不爱吃青椒";
            dtTree.Rows.Add(row3);
            DataRow row4 = dtTree.NewRow();
            row4["ID"] = "4";
            row4["Code"] = "004";
            row4["Name"] = "野原小白";
            row4["Description"] = "野原小白";
            row4["ParentID"] = "3";
            row4["tag"] = false;
            row4["Happy"] = "不爱吃青椒";
            dtTree.Rows.Add(row4);
            //模拟数据 将查询出来的datatable添加一列 例如:tag
            //然后查询datatable type列 当type为“板式”,“沙发”时 将tag列置为true
            DataRow[] drs = dtTree.Select("Happy='爱吃青椒'");
            foreach (DataRow item in drs)
            {
                item["tag"] = true;
            }
            treeList1.DataSource = dtTree;
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式