Skip to main content
A newer version of this page is available. .

BaseColumn.Width Property

Gets or sets the column’s width. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v19.2.Core.dll

Declaration

public GridColumnWidth Width { get; set; }

Property Value

Type Description
GridColumnWidth

A GridColumnWidth object that is a column width.

Remarks

If the automatic column width calculation is disabled, a column’s width is specified by its Width property. If the total column width exceeds the grid’s width, a horizontal scrollbar is displayed, allowing an end-user to scroll grid columns.

Column widths can be changed automatically, so that the total column width matches the grid’s width. In this instance, changing the width of one column automatically changes the widths of other columns. This behavior is controlled by the view’s TableView.AutoWidth property (TreeListView.AutoWidth for TreeListView). To obtain the actual width of columns, use their BaseColumn.ActualWidth property.

To specify the column’s minimum and maximum width, use the BaseColumn.MinWidth and BaseColumn.MaxWidth properties respectively.

Grid columns support both absolute and proportional (star) width value. The code sample below demonstrates how to set the absolute and star width for grid columns.

<dxg:GridControl.Columns>
    <!-- Absolute width -->
    <dxg:GridColumn FieldName="Name" Width="150"/>
    <!-- Proportional width -->
    <dxg:GridColumn FieldName="Birthday" Width="2*"/>
    <dxg:GridColumn FieldName="City" Width="2*"/>
    <dxg:GridColumn FieldName="Visits" Width="*"/>
</dxg:GridControl.Columns>

To learn more, see Columns Layout and Width.

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

Note

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