DevExpress Gridcontrol 表格头复选框 全选全不选

新建窗体 拖一个Gridcontrol 添加两列 col1,col2

 public partial class XtraForm2 : DevExpress.XtraEditors.XtraForm
    {
        public XtraForm2()
        {
            InitializeComponent();
        }
        private void XtraForm2_Load(object sender, EventArgs e)
        {
            //设置复选框
            gridView1.OptionsSelection.MultiSelect = true;
            gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect;
            //绑定数据源
            List list=new List();
            list.Add(new {col1="test",col2="test"});
            list.Add(new {col1="test",col2="test"});
            list.Add(new {col1="test",col2="test"});
            list.Add(new {col1="test",col2="test"});
            gridControl1.DataSource = list;
        }
    } 
  

DevExpress Gridcontrol 表格头复选框 全选全不选_第1张图片

你可能感兴趣的:(C#)