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

How to change background color of Header

3 Answers 327 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 06 Jun 2011, 03:20 AM

I'm using RadGridView control to view data.
My question is:

How to change the background color of header?
I want to change the background color of header similar with 2.jpg
Any Help will be appreciated!!!
Thanks in advance...

3 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 06 Jun 2011, 08:33 AM
Hello Bang,

I would suggest creating a new theme for your application, please take a look at visual style builder for this.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 06 Jun 2011, 08:39 AM
Hello again,

I might have been a beet hasty on my previous answer, if you just want the header color changed, just register to the ViewRowFormatting event and do the following:
void radGridView1_ViewRowFormatting(object sender, Telerik.WinControls.UI.RowFormattingEventArgs e)
{
    if (e.RowElement is GridTableHeaderRowElement)
    {
        e.RowElement.BackColor = Color.Pink;
        e.RowElement.NumberOfColors = 1;
        e.RowElement.DrawFill = true;
    }
    else
    {
        e.RowElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.RowElement.ResetValue(LightVisualElement.NumberOfColorsProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.RowElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
Charles
Top achievements
Rank 1
answered on 06 Jun 2011, 08:45 AM
Thanks, I found it two hours ago.
I just want the header color changed.
Tags
GridView
Asked by
Charles
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Charles
Top achievements
Rank 1
Share this question
or