【问题标题】:Adding a TextEdit to a column to a DevExpress GridView at runtime在运行时将 TextEdit 添加到 DevExpress GridView 的列
【发布时间】:2010-10-22 06:26:01
【问题描述】:

我正在尝试在运行时将 TextEdit 添加到 DevExpress GridView 上的列中,这就是我得到的(几乎从一些自动生成的设计器代码中复制)。

DevExpress.XtraEditors.Repository.RepositoryItemTextEdit commentTextEdit 
      = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
gvwEnquiryList.Columns["Comments"].ColumnEdit = commentTextEdit;
ctlEnquiryList.RepositoryItems.Add(commentTextEdit);

我错过了什么? (因为它不起作用,“评论”仍然只是一个普通的列)

【问题讨论】:

    标签: c# gridview devexpress


    【解决方案1】:

    使用下面的代码,我可以在我的文本字段中添加一个 TextEdit 列。我不需要使用 RepositoryItems.Add 函数。

            DevExpress.XtraEditors.Repository.RepositoryItemTextEdit commentTextEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
            commentTextEdit.Appearance.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
            commentTextEdit.Appearance.Options.UseBackColor = true;
            commentTextEdit.Name = "commentTextEdit";
    
            this.comments.ColumnEdit = commentTextEdit;
    

    【讨论】:

    • 啊哈,也许它需要名字 - 我会试试的。
    猜你喜欢
    • 1970-01-01
    • 2014-05-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多