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

gridTemplate Header Backcolor

1 Answer 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andre
Top achievements
Rank 1
Andre asked on 19 Oct 2018, 08:19 AM

how can i change the background color of a gridTemplate Header.

thanks

andré

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 19 Oct 2018, 12:13 PM
Hi Andre,

You can use the ViewCellFormatting event for this. Here is an example:
private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridHeaderCellElement && e.Row.ViewTemplate == radGridView1.Templates[0])
    {
        e.CellElement.DrawFill = true;
        e.CellElement.ForeColor = Color.Blue;
        e.CellElement.NumberOfColors = 1;
        e.CellElement.BackColor = Color.Aqua;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.NumberOfColorsProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
    }
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Andre
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or