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

BaseColumn.AllowBestFit Property

Gets or sets whether it is allowed to calculate an optimal width and apply it to the column.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

#Declaration

public DefaultBoolean AllowBestFit { get; set; }

#Property Value

Type Description
DefaultBoolean

A DefaultBoolean enumeration value that specifies whether it’s allowed to calculate an optimal width and apply it to the column.

Available values:

Name Description Return Value
True

The value is true.

0

False

The value is false.

1

Default

The value is specified by a global option or a higher-level object.

2

#Remarks

Table Views provide the capability to automatically calculate and apply the optimal width required for a column to completely display its contents. The Best Fit feature can be applied to an individual column, or to all columns displayed within a Table View. To enable this feature for all visible columns or individual columns, use the TableView.AllowBestFit and AllowBestFit properties, respectively.

If the AllowBestFit property is set to Default, this behavior is specified by the View’s TableView.AllowBestFit property.

To resize the specified column to the optimal width required to display its contents completely, use the TableView.BestFitColumn method. To resize all columns, use the TableView.BestFitColumns method. End users can resize columns to their optimal width (if allowed) by double clicking their right border or using the column header context menu.

Refer to the Best Fit topic to learn more.

The following code snippets (auto-collected from DevExpress Examples) contain references to the AllowBestFit 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