首页 > 其他分享 >DevExpress表格控件的单元格设置自定义编辑器

DevExpress表格控件的单元格设置自定义编辑器

时间:2022-11-30 16:34:34浏览次数:35  
标签:控件 自定义 DevExpress RepositoryItem RowHandle new emptyRepositoryItem

RepositoryItem emptyRepositoryItem = new RepositoryItem();
RepositoryItemCheckEdit checkEdit = new RepositoryItemCheckEdit();
RepositoryItemTextEdit textEdit = new RepositoryItemTextEdit();
RepositoryItemComboBox repositoryItemComboBox = new RepositoryItemComboBox();

    private void gridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
    {
        var gridView = sender as GridView;
        if (e?.Column?.Name == "checkEdit")
        {
            e.RepositoryItem = e.RowHandle % 2 == 1 ? checkEdit : emptyRepositoryItem;
        }
        else if (e?.Column?.Name == "textEdit")
        {
            e.RepositoryItem = gridView.RowCount - 6 == e.RowHandle || e.RowHandle == 1 ? textEdit : emptyRepositoryItem;
        }
        else if (e?.Column?.Name == "repositoryItemComboBox")
        {
            e.RepositoryItem = e.RowHandle == gridView.RowCount - 1 || e.RowHandle == 0 || e.RowHandle % 2 != 0
                ? emptyRepositoryItem
                : repositoryItemComboBox;
        }
    }
  • DevExpress中的表格控件(GridControl、TreeList、Gantt、spreadsheet),理论上都可通过CustomRowCellEdit事件每一个单元格设置独有的编辑控件类型,可以根据具体的需求调整。

标签:控件,自定义,DevExpress,RepositoryItem,RowHandle,new,emptyRepositoryItem
From: https://www.cnblogs.com/beiyougaolou/p/16938863.html

相关文章

  • DevExpress文本编辑类控件设置水印
    为TextEdit增加水印publicstaticclassTextEditHelper{//设置水印值publicstaticvoidSetWatermark(thisTextEdittextEdit,stringwatermark){......
  • 自定义JetBrains的IDE界面缩放比例
    今天双11的时候,将我的换了一个27寸的4k分辨率的显示器,经过几周的使用,基本上已经适应了4k分辨率下的175%的缩放比率,但是Jetbrains的几个IDE使用新的UI的时候,在这个分辨率下......
  • BI好物推荐:这两个功能控件绝不能错过
    在BI数据分析工具上,通过点击和拖拉拽能够很快完成BI数据可视化分析报表,但如果你掌握了下面这两个BI数据分析功能与控件,不管是效率还是数据分析的灵活自主性都将得到极大的提......
  • 直播平台源代码,el-button自定义图片显示
    直播平台源代码,el-button自定义图片显示1在按钮处自定义icon          <el-button@click="to_devops(scope.row.pr_url)">       ......
  • 跨平台.NET应用UI组件DevExpress XAF v22.1 - 增强Web API Service
    DevExpressXAF是一款强大的现代应用程序框架,允许同时开发ASP.NET和WinForms。DevExpressXAF采用模块化设计,开发人员可以选择内建模块,也可以自行创建,从而以更快的速度和比......
  • MFC-Combo下拉框控件
           ......
  • 【自定义控件】MyPanelParent MyParent
    代码MyPanelParent.csusingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;usingSystem.Windows......
  • 判断闰年(自定义函数)
    #pragmawarning(disable:4996)#include<stdio.h>panduanrunnian(intn){if((n%4==0&&n%100!=0)||(n%400==0)){return1;}elsereturn0;}......
  • 自定义构造函数 创建对象
    函数适用于封装方法的  构造函数就是用于封装对象的1.构造函数首字母大写2.调用通过newnew函数名()3.通过this添加属性//functionPig(name,age){//......
  • 自定义数组的方法
    <body><script>//自己定义数组扩展方法求和和最大值//console.dir(Array);//console.log(Array.prototype);//Array.prototyp......