Saturday, January 24, 2015

RadGridView - Chagne Forecolor and Backcolor Of Grouped Row

The version of Telerik Winforms is 2010 SP1.
It's simple to change the forecolor, you need to implement the ViewCellFormatting event handler.
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
 e.cellElement.ForeColor = Color.Blue;
}
While it's a little bit tricky to change the backcolor. You should not directly manipulate the cell element, like the following:
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
 e.CellElement.BackColor = Color.Yellow
}
Instead, you need to use the row element.
void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
 e.CellElement.RowElement.BackColor = Color.Yellow
}


Create a Successful Online Store at Bigcommerce! Try it Free Now!

No comments:

Post a Comment