DevExpress的GridView中指定不同的编辑器

主要通过CustomRowCellEdit事件里指定。需要注意一点,如果不是通过Run Designer里添加的repositoryItem项目,则需要RepositoryItems中手动添加下编辑器,如示例里添加的是颜色编辑器:

RepositoryItemColorPickEdit edit = new RepositoryItemColorPickEdit();
gdcProperties.RepositoryItems.Add(edit);

 然后添加GridView中CustomRowCellEdit事件: 

//初始化或load方法中加入事件
gdvProperties.CustomRowCellEdit += GdvProperties_CustomRowCellEdit;
private void GdvProperties_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
{
if (e.Column.FieldName == "Value" && e.RowHandle == 8)
{
e.RepositoryItem = edit;
}
}

 

 

posted @   东经115  阅读(321)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示