All docs
V20.1
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

TreeList.GetColumnHeaderBestWidth(TreeListColumn) Method

Returns the column header width that allows the content to be displayed in its entirety.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v20.1.dll

Declaration

public int GetColumnHeaderBestWidth(
    TreeListColumn column
)
Public Function GetColumnHeaderBestWidth(
    column As TreeListColumn
) As Integer

Parameters

Name Type Description
column TreeListColumn

An object that specifies the column for which to calculate the width.

Returns

Type Description
Int32

An integer value that specifies the width.

Remarks

The TreeListColumn.GetHeaderBestWidth and TreeList.GetColumnHeaderBestWidth(TreeListColumn) methods return the header width that allows the header content to be displayed in its entirety. For example, since different skins may have different optimal header widths, you can use these methods to recalculate a column's width when the current skin changes.

Examples

The code below shows how to automatically update the column width when look and feel settings change.

treeList1.LookAndFeel.StyleChanged += LookAndFeel_StyleChanged;

private void LookAndFeel_StyleChanged(object sender, EventArgs e) {
    treeListColumn1.Width = treeListColumn1.GetHeaderBestWidth();
    //treeListColumn1.Width = treeList1.GetColumnHeaderBestWidth(treeListColumn1);
}
See Also