Skip to main content

TreeList.BestFitColumns(Boolean) Method

Modifies the width of each visible column so that the contents of its cells are not truncated, if possible. Allows you to resize columns to fit the treelist width.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v24.1.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

public virtual void BestFitColumns(
    bool applyAutoWidth
)

Parameters

Name Type Description
applyAutoWidth Boolean

true if the total width of columns must be equal to the control’s width after resizing; otherwise false.

Remarks

Call the BestFitColumns method to resize columns to the minimum width to display their contents without trimming, if possible.

The applyAutoWidth parameter is in effect if the TreeListOptionsView.AutoWidth option is disabled. Otherwise, the BestFitColumns method performs column resizing as if the applyAutoWidth parameter were set to true.

Columns - BestFitAutoWidth

Use the TreeListOptionsView.BestFitNodes property to specify which nodes take part in calculating the largest column cell.

Note

All columns are resized when the BestFitColumns method is called even if the TreeListOptionsColumn.AllowSize option of columns is disabled.

To apply the “best fit” functionality to a certain column, use the TreeListColumn.BestFit method.

Note

If the TreeList control is created at design time, you cannot change the visual settings or size of the control and its elements (for example, by invoking the best fit functionality) until the Tree List has completed its initialization. To customize these settings in the form’s System.Windows.Forms.Form.Load event handler, call the TreeList.ForceInitialize method prior to performing additional customization.

See Also