This is a migrated thread and some comments may be shown as answers.

Changing back color of GridTextBoxColumn while editing in RadGridView control

1 Answer 158 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Cheryl
Top achievements
Rank 1
Cheryl asked on 28 May 2015, 02:18 PM

Hello 

I need to change  back color of GridTextBoxColumn while editing in RadGridView control.

My application have two themes BLACK and WHITE.

For BLACK theme textcolor is white editing GridTextBoxColumn  the backcolor is white and textcolor is same so I'm unable see the typed text.

So far I have tried below approach

 GridViewDataRowInfo row = new GridViewDataRowInfo(this.dataGridView1.MasterView);
                row.Cells[0].Value = "";
                row.Cells[1].Value = "";
                row.Cells[0].Style.CustomizeFill = true;
                row.Cells[0].Style.DrawFill = true;
                row.Cells[0].Style.BackColor = ColorTranslator.FromHtml("41,44,41");
                dataGridView1.Rows.Add(row);

 

Where-

row.Cells[0] is GridTextBoxColumn

row.Cells[1] is GridCommandColumn 

but the changes are not affecting white editing text.

Please help.

 

Thanks in advance.

 

1 Answer, 1 is accepted

Sort by
0
Todor Vyagov
Telerik team
answered on 29 May 2015, 09:08 AM
Hello Cheryl,

Thank you for writing.

To change the background color of cell in edit mode you can subscribe to RadGridView's CellEditorInitialized event and set the BackColor of RadTextBoxEditor's RadTextBoxItem and FillPrimitive children.
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadTextBoxEditor editor = e.ActiveEditor as RadTextBoxEditor;
    if (editor != null)
    {
        (editor.EditorElement.Children[0] as RadTextBoxItem).BackColor = Color.FromArgb(41, 44, 41);
        (editor.EditorElement.Children[1] as FillPrimitive).BackColor = Color.FromArgb(41, 44, 41);
    }
}

I hope this information helps.

Regards,
Todor Vyagov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Cheryl
Top achievements
Rank 1
Answers by
Todor Vyagov
Telerik team
Share this question
or