//文本按钮
RepositoryItemButtonEdit btnFields = new RepositoryItemButtonEdit();//创建控件
btnFields.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(btnField_ButtonClick);//事件绑定
gridView1.Columns["Fields"].ColumnEdit = btnFields;//绑定单元格
void btnField_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
//事件处理
}
//选择框
RepositoryItemCheckEdit btnBExport = new RepositoryItemCheckEdit();
btnBExport.QueryCheckStateByValue += new DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventHandler(btnBExport_QueryCheckStateByValue);
gridView1.Columns["BExport"].ColumnEdit = btnBExport;
void btnBExport_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e)
{
switch (e.Value.ToString())
{
case "True"://也可以绑定0,1;yes,no等
e.CheckState = CheckState.Checked;
break;
case "False":
e.CheckState = CheckState.Unchecked;
break;
default:
e.CheckState = CheckState.Unchecked;
break;
}
e.Handled = true;
}