首页 > 代码库 > CheckedComboxEdit

CheckedComboxEdit

绑定方法1:追加Items的方式(建议采用绑定方式)

//清空项            checkedComboBoxEdit1.Properties.Items.Clear();            checkedComboBoxEdit1.Properties.Items.Add(1, "新建");            checkedComboBoxEdit1.Properties.Items.Add(2, "审批中");            checkedComboBoxEdit1.Properties.Items.Add(3, "已完成");            checkedComboBoxEdit1.Properties.Items.Add(4, "已撤销");            foreach (DevExpress.XtraEditors.Controls.CheckedListBoxItem cbi in this.checkedComboBoxEdit1.Properties.Items)            {                if (cbi.Value.Equals(2) || cbi.Value.Equals(1))                {                    cbi.CheckState = CheckState.Checked;                }            }

绑定方法2:绑定数据源的方式(注意这种绑定方式,Popup事件里才可以获取this.checkedComboBoxEdit1.Properties.Items的真实数值,并且无法设置具体项目的CheckState)

            List<DepartmentInfo> list_departments = new List<DepartmentInfo>();            list_departments = DataFactory.GetDepartmentList();            this.checkedComboBoxEdit1.Properties.DataSource = list_departments;            this.checkedComboBoxEdit1.Properties.DisplayMember = "DepartmentName";            this.checkedComboBoxEdit1.Properties.ValueMember = "DepartmentID";

  

CheckedComboxEdit