gridTemplate Header Backcolor

2 posts, 1 answers
  1. Andre
    Andre avatar
    41 posts
    Member since:
    Feb 2018

    Posted 19 Oct 2018 Link to this post

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



  2. Answer
    Dimitar avatar
    2892 posts

    Posted 19 Oct 2018 Link to this post

    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;
            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.

    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.
Back to Top