Skip to main content

GridColumn.Width Property

Gets or sets the column width.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v24.1.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation


public virtual int Width { get; set; }

Property Value

Type Default Description
Int32 75

The column’s width.


Use the Width property to set the column width to a custom value. The GridColumn.MinWidth property defines the minimum possible width for the column. If the Width property value is less, it is automatically changed to GridColumn.MinWidth.

You can obtain the actual column width from the GridColumn.VisibleWidth property. This property can be useful in column auto-width mode (GridOptionsView.ColumnAutoWidth), in which column visible widths are automatically calculated to fit the View’s width.

Column Auto-Width Mode

In code, to initialize multiple column widths in column auto-width mode (GridOptionsView.ColumnAutoWidth), set the GridColumn.Width settings and wrap these customizations with the BaseView.BeginUpdate and BaseView.EndUpdate method pair. A single column’s GridColumn.Width setting needs to be set to a value that is proportional to other column widths, as they will adjust themselves to the grid’s width.

In column auto-width mode, the GridColumn.Width and GridColumn.VisibleWidth settings are not synced in the following cases:

However, when you resize any column in auto-width mode, the GridColumn.Width and GridColumn.VisibleWidth settings of all columns are immediately synced. If you then resize the View horizontally, the GridColumn.Width and GridColumn.VisibleWidth settings will be out of sync again.

When you switch the GridOptionsView.ColumnAutoWidth option from true to false, column visible widths are set to the GridColumn.Width settings.

The code sample below illustrates how to set fixed width to the Product Status grid column and variable widths to other columns.

gridView1.Columns["productStatus"].Width = 50;
gridView1.Columns["productStatus"].OptionsColumn.FixedWidth = true;
gridView1.OptionsView.ColumnAutoWidth = true;

The following code snippets (auto-collected from DevExpress Examples) contain references to the Width property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also