Skip to main content
A newer version of this page is available. .

Columns

  • 3 minutes to read

The Tree List control displays data by means of nodes and columns. If the control is bound to a data source, columns represent fields while nodes correspond to records.

Columns - Columns

Column Objects

The Tree List control stores columns in the TreeList.Columns collection. Each column, represented by a TreeListColumn class object, provides properties to specify the column’s visibility, display caption, width, in-place editor, appearance and formatting settings, etc. However, the column’s main property is TreeListColumn.FieldName. In bound mode, it specifies the data source field whose data is displayed in the current column.

You can access columns via the indexer provided by the TreeList.Columns collection. The indexer accepts either the index of the column or the name of the bound field. TreeListColumn objects are components. So, if columns are created at design time, you can access them by names in code, like other components.

The focused column can be accessed via the TreeList.FocusedColumn property. Together with the focused node (TreeList.FocusedNode), the focused column identifies the currently focused cell. If you want to move focus to another column, assign this column to the TreeList.FocusedColumn property.

Column Layout

The position of columns within the TreeList.Columns collection does not specify their visible order. The visual position of a column is specified via its TreeListColumn.VisibleIndex property. Set this property to -1, to hide the column. Setting it to a non-negative integer makes it visible again.

End-users have the ability to customize the layout of columns at runtime (rearrange, hide and restore columns). To rearrange columns, they can use drag-and-drop. To hide certain columns, they need to invoke the Customization Form and drag columns by their header from the Tree List control onto the Customization Form.

CustomizationForm - Another

To access and restore hidden columns, end-users need to again display the Customization Form, and drag columns back from the form to the Tree List control. Note that moving columns to/from the Customization Form modifies the TreeListColumn.VisibleIndex property.

By default, columns are proportionally resized to fit the Tree List control’s width in its entirety. You can disable this feature via the TreeListOptionsView.AutoWidth property. In this instance, columns will have the exact width specified by the TreeListColumn.Width property.

Column Behavior

You can disable and enable various behavior options for columns via the TreeListColumn.OptionsColumn property. This property provides access to the following settings:

Appearance Options

A column’s appearance can be modified by:

See Also