把 combobox里面的项换成checkedbox
示例:
combobox cbb=new combobox(); if (null != ItemList && ItemList.Count > 0) { CheckBox cb = new CheckBox(); cb.CommandParameter = cbb.Name; cb.Tag = "check_All"; cb.Content = "全部选择"; cb.Click += new RoutedEventHandler(cb_Click); cbb.Items.Add(cb); foreach (var dr in ItemList) { cb = new CheckBox(); cb.CommandParameter = cbb.Name; cb.Tag = dr.FLID; cb.Content = dr.Gradation; cb.Click += new RoutedEventHandler(cb_Click); cbb.Items.Add(cb); } }[code=C#][/code] DataModel 这是张表,表中包含FLID和Gradation两个字段 List<DataModel> ItemList=new List<DataModel> (); 然后往ItemLIst中添加数据就OK~~~
时间: 2024-11-08 06:36:24