Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GridColumn.Width Property

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

Namespace: DevExpress.Maui.DataGrid

Assembly: DevExpress.Maui.DataGrid.dll

NuGet Package: DevExpress.Maui.DataGrid

#Declaration

C#
[TypeConverter(typeof(GridLengthTypeConverter))]
public GridLength Width { get; set; }

#Property Value

Type Description
GridLength

The column width in pixels.

#Remarks

DataGridView adjusts column widths to make the total column width equal to the grid width. When you set the Width property for a column, the grid automatically resizes other columns. To specify minimum and maximum width limits for a column, use MinWidth and MaxWidth properties.

The Width property allows you to define the absolute or proportional (star) width value but does not support the Auto option. When you set a proportional column size, the remaining available space is distributed among columns similar to the standard grid that uses the same star sizing mechanism.

<dxg:DataGridView.Columns>
    <!-- Absolute width -->
    <dxg:TextColumn FieldName="Name" Width="150"/>
    <!-- Proportional width -->
    <dxg:DateColumn FieldName="Birthday" Width="2*"/>
    <dxg:TextColumn FieldName="City" Width="2*"/>
    <dxg:NumberColumn FieldName="Visits" Width="*"/>
</dxg:DataGridView.Columns>

If the total width of all columns exceeds the grid width, users can scroll grid columns horizontally. To maintain a column within the visible grid area, set the column’s FixedStyle property to True. You can use the IsHorizontalScrollBarVisible property to display or hide a horizontal scrollbar.

See Also