Background color of group header row

3 posts, 0 answers
  1. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 10 Aug 2015 Link to this post

    I have implemented custom grouping for a GridView and would like to change the group header background color for some groups based on the grouped rows.

    How would I do that?

     -Lou

  2. Lou
    Lou avatar
    61 posts
    Member since:
    Aug 2014

    Posted 10 Aug 2015 Link to this post

    Never mind - I found the documentation for how to do this. Here's the code I used:

        If TypeOf e.CellElement.RowInfo Is GridViewGroupRowInfo Then
          If (condition) Then
            e.CellElement.RowElement.BackColor = Color.Red
            e.CellElement.RowElement.GradientStyle = GradientStyles.Solid
            e.CellElement.RowElement.DrawFill = True
          Else
            e.CellElement.RowElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local)
            e.CellElement.RowElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local)
            e.CellElement.RowElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local)
          End If
        End If

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 11 Aug 2015 Link to this post

    Hi Lou,

    Using the formatting events is the correct solution. If you have any questions, please do not hesitate to contact us.
     
    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
Back to Top