Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

DataGridView.RowsDefaultCellStyle Property

Gets or sets the default style applied to the row cells of the DataGridView.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
member RowsDefaultCellStyle : DataGridViewCellStyle with get, set

Property Value

Type: System.Windows.Forms.DataGridViewCellStyle
The DataGridViewCellStyle to apply to the row cells of the DataGridView.

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

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

When getting this property, a 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 DataGridViewCellStyle to set this property for multiple rows. For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

The following code example illustrates how to use this property to create a ledger effect in a DataGridView control. This example is part of a larger example available in the DataGridViewCellStyle class overview.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.