Changing background color of column headers

2 posts, 0 answers
  1. Alan
    Alan avatar
    9 posts
    Member since:
    Mar 2009

    Posted 22 Jun 2012 Link to this post

    How do I programmically change the background color of the column headers in a DetailsView ListView? I know there is a VisualItemFormatting event, but I am not sure if the headers pass through this event.
  2. Boryana
    Boryana avatar
    330 posts

    Posted 26 Jun 2012 Link to this post

    Hi Alan,

    Thank you for writing.

    You can use the CellFormatting event to set the BackColor property.
    void radListView1_CellFormatting(object sender, ListViewCellFormattingEventArgs e)
        if (e.CellElement is DetailListViewHeaderCellElement)
            e.CellElement.BackColor = Color.Red;
            e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);

    Do not forget to reset the BackColor property if the cell element is not a details column header.

    I hope this helps. Let me know if you have further questions.

    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. DevCraft banner
Back to Top