Back to Devexpress

TreeListView.AutoWidth Property

wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-75023ad3.md

latest5.5 KB
Original Source

TreeListView.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.v25.2.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public bool AutoWidth { get; set; }
vb
Public Property AutoWidth As Boolean

Property Value

TypeDescription
Boolean

true to enable the column auto width feature; otherwise, false. The default is false.

|

Remarks

Column widths can be changed automatically, so that the total columns’ 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 AutoWidth property. To obtain the actual width of columns, use their BaseColumn.ActualWidth property.

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, set its BaseColumn.Fixed property.

To learn more, see Columns Layout and Width and Fixed Columns and Bands.

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.

wpf-tree-list-calculate-custom-node-summaries/CS/CustomNodeSummaries_CodeBehind/MainWindow.xaml#L13

xml
<dxg:TreeListControl.View>
    <dxg:TreeListView AutoExpandAllNodes="True" AutoWidth="True"
                      KeyFieldName="ID" ParentFieldName="ParentID"

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/MainWindow.xaml#L52

xml
<dxg:TreeListControl.View>
    <dxg:TreeListView x:Name="view" TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childrenSelector}" ShowIndicator="False" ShowColumnHeaders="False" AutoWidth="True" AllowPerPixelScrolling="False" CustomColumnDisplayText="view_CustomColumnDisplayText" />
</dxg:TreeListControl.View>

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/MainWindow.xaml#L52

xml
<dxg:TreeListControl.View>
    <dxg:TreeListView x:Name="view" TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childrenSelector}" ShowIndicator="False" ShowColumnHeaders="False" AutoWidth="True" AllowPerPixelScrolling="False" CustomColumnDisplayText="view_CustomColumnDisplayText" />
</dxg:TreeListControl.View>

wpf-richedit-document-api/CS/DXRichEditControlAPISample/MainWindow.xaml#L57

xml
<dxg:TreeListControl.View>
    <dxg:TreeListView x:Name="view" TreeDerivationMode="ChildNodesSelector" ChildNodesSelector="{StaticResource childrenSelector}" ShowIndicator="False" ShowColumnHeaders="False" AutoWidth="True" AllowPerPixelScrolling="False" CustomColumnDisplayText="view_CustomColumnDisplayText" />
</dxg:TreeListControl.View>

wpf-lookupedit-display-treelist-as-popup-content/CS/CustomTreeViewComboBox/MainWindow.xaml#L17

xml
<dxg:GridControl.View>
    <dxg:TreeListView AutoWidth="True"
                      AutoExpandAllNodes="True"

See Also

TreeListView Class

TreeListView Members

DevExpress.Xpf.Grid Namespace