Export (0) Print
Expand All

DataGridViewColumn.DefaultCellStyle Property

Gets or sets the column's default cell style.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

abstract DefaultCellStyle : DataGridViewCellStyle with get, set
override DefaultCellStyle : DataGridViewCellStyle with get, set

Property Value

Type: System.Windows.Forms.DataGridViewCellStyle
A DataGridViewCellStyle that represents the default style of the cells in the column.

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 this column, the styles specified through the DefaultCellStyle property override the styles specified through the DataGridView.DefaultCellStyle property, but are overridden by the styles specified through the DataGridView.RowsDefaultCellStyle, DataGridView.AlternatingRowsDefaultCellStyle, DataGridViewRow.DefaultCellStyle, and DataGridViewCell.Style properties.

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

The following code example uses the DefaultCellStyle property to set the content alignment of various columns.

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

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft