Using available examples, applying different formatting to row header does not work as the RowElement never comes in as a GridTableHeaderRowElement. New rows are formatting correctly.
private void RadGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
{
try
{
if ((string)e.RowElement.RowInfo.Tag == "new row")
{
e.RowElement.DrawFill = true;
e.RowElement.BackColor = System.Drawing.Color.LightCyan;
e.RowElement.ForeColor = System.Drawing.Color.Black;
e.RowElement.Text = "New";
e.RowElement.TextAlignment = System.Drawing.ContentAlignment.TopLeft;
}
else if (e.RowElement is GridTableHeaderRowElement)
{
e.RowElement.DrawFill = true;
e.RowElement.BackColor = System.Drawing.Color.Navy;
e.RowElement.NumberOfColors = 1;
e.RowElement.ForeColor = System.Drawing.Color.White;
e.RowElement.Text = "";
}
else
{
e.RowElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.NumberOfColorsProperty, Telerik.WinControls.ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, Telerik.WinControls.ValueResetFlags.Local);
e.RowElement.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show($"Uncaught error in {System.Reflection.MethodBase.GetCurrentMethod().Name}: {ex.Message}");
}
}