Hi!
I want to change the background color of the selected row, i also want some headings to have a different color. So far so good..When I click on the "Add new row" I don't want the selected row to go back to the default color, but stay the way it was. Any suggestions on how to accomplish that? This is my code so far:
private void rgv_RowFormatting(object sender, RowFormattingEventArgs e)
{
if (e.RowElement is GridDataRowElement)
{
if (e.RowElement.RowInfo.IsCurrent) //Selected row
{
e.RowElement.BackColor = Color.PaleVioletRed;
e.RowElement.GradientStyle = GradientStyles.Solid;
e.RowElement.DrawFill = true;
}
else if ((int)e.RowElement.RowInfo.Cells["Heading"].Value == 1) //Color on heading
{
e.RowElement.BackColor = Color.GreenYellow;
e.RowElement.GradientStyle = GradientStyles.Solid;
e.RowElement.DrawFill = true;
}
else //Reset color
{
e.RowElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
}
}
}