ColumnBase.Width Property
In This Article
Gets or sets the column width. This is a dependency property.
Namespace: DevExpress.WinUI.Grid
Assembly: DevExpress.WinUI.Grid.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
[DP(120, Handler = "OnWidthChanged", IsNew = true)]
public GridColumnWidth Width { get; set; }
#Property Value
Type | Description |
---|---|
Grid |
A column’s width. |
#Remarks
If you disable automatic column width calculation (set the DataControlBase.AutoWidth property to false), you can use a column’s Width property. If the total column width exceeds the grid width, the GridControl displays a horizontal scrollbar that allows users to scroll grid columns.
<dxg:GridControl ItemsSource="{x:Bind ViewModel.Products}"
AutoGenerateColumns="False"
AutoWidth="False">
<dxg:GridControl.Columns>
<!-- Absolute width in pixels -->
<dxg:GridTextColumn FieldName="ProductName" Width="150"/>
<!-- Proportional (star) width -->
<dxg:GridTextColumn FieldName="Country" Width="*"/>
<dxg:GridTextColumn FieldName="City" Width="2*"/>
<!-- Auto width -->
<dxg:GridSpinEditColumn FieldName="UnitPrice" Width="Auto"/>
<dxg:GridTextColumn FieldName="Quantity" Width="Auto"/>
</dxg:GridControl.Columns>
</dxg:GridControl>
See Also