TableView.AutoWidth Property
Gets or sets whether column widths are automatically changed so that the total columns’ width matches the grid’s width. This is a dependency property.
Namespace: DevExpress.Xpf.Grid
Assembly: DevExpress.Xpf.Grid.v24.1.dll
NuGet Package: DevExpress.Wpf.Grid.Core
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
Boolean | false | true, to enable the column auto width feature; otherwise, false. |
#Remarks
Set the AutoWidth property to true to make the GridControl change the column widths automatically. In this case, when an end user changes a column’s width, the GridControl changes the widths of other columns.
<dxg:GridControl AutoGenerateColumns="AddNew"
EnableSmartColumnsGeneration="True"
ItemsSource="{Binding Customers}">
<dxg:GridControl.View>
<dxg:TableView AutoWidth="True"/>
</dxg:GridControl.View>
</dxg:GridControl>
Use the BaseColumn.ActualWidth property to obtain the column width.
If the automatic column width calculation is disabled, a column’s width is specified by its BaseColumn.Width property. If the total columns’ width exceeds the grid’s width, a horizontal scrollbar is displayed, allowing an end user to scroll grid columns. If you want a column (or columns) to always be displayed onscreen, regardless of scrolling, specify the BaseColumn.Fixed property.
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the AutoWidth 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.