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

Background color of total summary row different than other summary rows

1 Answer 193 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 30 Mar 2013, 02:07 PM
See attached image, I would like to change background color to the very last total row while leaving the subtotal rows background color.

Is that possible?

Best Regards
Andrea.


1 Answer, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 03 Apr 2013, 01:29 PM
Hi Andrea,

You can do this by handling the ViewCellFormatting event. The Groups property of DataGroup class can be used to determine whether the current row has child groups. Here is a sample:
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    GridGroupContentCellElement cell = e.CellElement as GridGroupContentCellElement;
    if (cell != null)
    {
        GridViewGroupRowInfo row = (GridViewGroupRowInfo)cell.RowInfo;
        if (row.Group.Groups.Count == 0)
        {
            cell.BackColor = Color.Red;
            cell.DrawFill = true;
            return;
        }
        cell.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
        cell.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
    }
}

I hope it helps.
 
Greetings,
Jack
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
GridView
Asked by
Andrea
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or