简体   繁体   中英

Adding a TextEdit to a column to a DevExpress GridView at runtime

I am trying to add a TextEdit to a column on a DevExpress GridView at runtime, this is what I have got (copied pretty much from some auto-generated designer code).

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

What have I missed? (cos it doesn't work, "Comments" is still just a normal column)

Using code below I was able to add a TextEdit column to my text field. I didn't need to use the RepositoryItems.Add function.

        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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM