System.Windows.Forms.DataGridView.AlternatingRowsDefaultCellStyle Property

Gets or sets the default cell style applied to odd-numbered rows of the System.Windows.Forms.DataGridView.

Syntax

public DataGridViewCellStyle AlternatingRowsDefaultCellStyle { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The System.Windows.Forms.DataGridView control displays its cells using the styles indicated by the cell DataGridViewCell.InheritedStyle property, which inherits styles from other properties of type System.Windows.Forms.DataGridViewCellStyle. For cells in rows with odd index numbers, the styles specified through the DataGridView.AlternatingRowsDefaultCellStyle property override the styles specified through the DataGridView.DefaultCellStyle, DataGridViewColumn.DefaultCellStyle, and DataGridView.RowsDefaultCellStyle, and are overridden by the styles specified through the DataGridViewRow.DefaultCellStyle and DataGridViewCell.Style properties.

For more information, see Cell Styles in the Windows Forms DataGridView Control.

When getting this property, a System.Windows.Forms.DataGridViewCellStyle with default values will be created if the property has not already been accessed. This can cause a performance impact when getting this property for many rows. Whenever possible, use a single System.Windows.Forms.DataGridViewCellStyle to set this property for multiple rows. For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0