1,使用 CustomRowCellEditForEditing事件:通过重写默认的列编辑器,允许你指定一个合适的自定义编辑器,该自定义编辑器既适用于显示模式也适于编辑模式。
2,
// 摘要:// Allows you to assign a custom editor to a column for in-place editing and
// so override the default column editor, which is by default used both in display
// and edit modes.
[DevExpressXtraGridLocalizedDescription("GridViewCustomRowCellEditForEditing")]
[DXCategory("Editor")]
public event CustomRowCellEditEventHandler CustomRowCellEditForEditing;
3,实例
gridView1.CustomRowCellEditForEditing += delegate(object sender, CustomRowCellEditEventArgs e)
{
if (!e.Column.FieldName.Equals("wtfldm"))//非选中列直接返回
return;
RepositoryItemFilterTreeListLookUpEdit comboxClassfiy = new RepositoryItemFilterTreeListLookUpEdit();//声明树控件
string strZbdm = gridView1.GetFocusedDataRow() == null ? string.Empty : gridView1.GetFocusedDataRow()["wtzbdm"].ToStringEx();
DataTable dtClassify = GetClassify(strZbdm.ToStringEx());//根据焦点行的 wtzbdm 列的值获取不同的数据源
if (dtClassify == null)
return;
comboxClassfiy.BindDataSource(dtClassify, "wtfldm", "问题分类代码", "wtflmc", "问题分类名称", "sjwtfl", "0");
e.RepositoryItem = comboxClassfiy;//单元格绑定树控件
};