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

Modifying font and backgroud of group by row in RadGridView

2 Answers 525 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 15 Jul 2015, 08:31 PM

I have a RadGridView that is using the group by functionality.

 When grouping by a column, the group by rows are created.

I would like to change the font, background color, etc. of the group by row, but cannot figure out how. (They don't seem to take any formatting from the rows before the group by)

 

Thank you.

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Jul 2015, 12:35 PM
Hello Nathan,

Thank you for contacting us.

You can use the ViewCellFormatting event to style the cells in the group row. For example:
Font myFont = new Font("Segoe Script", 10, FontStyle.Regular);
void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    if (e.CellElement is GridGroupContentCellElement)
    {
        e.CellElement.BackColor = Color.Red;
        e.CellElement.Font = myFont;
        e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        e.CellElement.DrawFill = true;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
}

Detailed information about this is available in the following articles: 
I hope this helps. Should you have any other questions do not hesitate to ask.
 
Regards,
Dimitar
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
0
Nathan
Top achievements
Rank 1
answered on 16 Jul 2015, 04:31 PM

That worked.

 Thank you.

Tags
GridView
Asked by
Nathan
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Nathan
Top achievements
Rank 1
Share this question
or