$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
DataGridView for Windows Forms
Create data gird view in C# with modern user interface for your Windows Forms applications
Home > WinForms UI Controls > User Manual > Format Rows in C#

Rows and Child Rows of C# DataGridView

The Kettic DataGridView Control allows users of the GridView control to create custom formatting data rows for the grid in C# Windows Forms applications. A row in the grid stands for a record that is from the Data Source and the Kettic DataGridView Control provides the RowFormat event to create custom formatting data rows in C#.NET Windows Forms applications.

Create Custom Data Rows Appearance in C#

To customize the appearance of the data rows to DataGridView component for Windows Forms application, users of the GridView control can use RowFormat event to apply custom formatting data rows to DataGridView. The following is a sample C# code snippet that shows how to create custom background color to data rows to GridView control in Windows Forms .NET project.

Create Custom Formatting Data Row to GridView in C#


private void ketticGridView_RowFormat(object sender, RowFormatEventArgs e)
{
if ((bool)e.RowElement.RowInformation.Cells["BMP"].Value == true)
{
e.RowElement.DrawFill = true;
e.RowElement.GradientStyle = GradientStyles.Solid;
e.RowElement.BackColor = Color.Aqua;
}
else
{
e.RowElement.ResetValue(LightVisualElement.BackColorParameter, ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.GradientStyleParameter, ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.DrawFillParameter, ValueResetFlags.Local);
}
}

Create Custom Non-Data Rows Appearance in C#

To customize the appearance of the non-data rows, including header row, new row, filtering row, to DataGridView component for Windows Forms application, users of the GridView control can use ViewRowFormat event to apply custom formatting non-data rows to DataGridView. The following is a sample C# code snippet that shows how to create custom formatting non-data rows to GridView in Windows Forms .NET project.

Create Custom Formatting Non-Data Row to GridView in C#


void ketticGridView_ViewRowFormat(object sender, RowFormatEventArgs e)
{
Console.WriteLine(e.RowElement.GetType());
if (e.RowElement is GridTableHeaderRowElement)
{
e.RowElement.DrawFill = true;
e.RowElement.BackColor = Color.Navy;
e.RowElement.NumberOfColors = 1;
e.RowElement.ForeColor = Color.White;
}
else
{
e.RowElement.ResetValue(LightVisualElement.DrawFillParameter, ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.BackColorParameter, ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.NumberOfColorsParameter, ValueResetFlags.Local);
e.RowElement.ResetValue(LightVisualElement.ForeColorParameter, ValueResetFlags.Local);
}
}
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls