Background color of total summary row different than other summary rows

2 posts, 1 answers
  1. Andrea
    Andrea avatar
    73 posts
    Member since:
    Oct 2012

    Posted 30 Mar 2013 Link to this post

    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.


  2. Answer
    Jack
    Admin
    Jack avatar
    2333 posts

    Posted 03 Apr 2013 Link to this post

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