TreeListColumn.VisibleIndex Property
Gets or sets the position in the Tree List where the current column is displayed.
Namespace: DevExpress.XtraTreeList.Columns
Assembly: DevExpress.XtraTreeList.v24.2.dll
Declaration
[DefaultValue(-1)]
[XtraSerializableProperty]
[XtraSerializablePropertyId(3)]
public int VisibleIndex { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Int32 | -1 | An Integer value that specifies the position of the current column in the Tree List. |
Remarks
Use this property to set the position of columns created manually or move the existing column to a new position. Unlike the TreeListColumn.AbsoluteIndex property, this property defines the column position among visible columns (TreeList.VisibleColumns). If the VisibleIndex property is set to -1, the current column is not displayed.
The VisibleIndex property cannot be set to a value less than -1, or greater than the number of currently visible columns. When assigning a value outside of these bounds, the value is automatically set to either -1 or the last available index.
When you use the VisibleIndex property to move a column forward (i.e., assign a new visible index that is higher than the current visible index), the current column is actually moved to the position before the column, whose VisibleIndex equals to the assigned value. So, the actual visible index will be the assigned value minus one. When you move a column backward using the VisibleIndex property (i.e. assign a new visible index that is lower than the current visible index), the current column is moved to the position specified by the assigned value. The actual visible index will match the assigned value.
Note
The VisibleIndex property cannot be used to change the positions of columns in banded mode. Instead of this property, use the TreeList.SetColumnPosition and TreeListBand.Columns.SetColumnIndex methods.
Example
The following example adds a column bound to the “Phone” field and displays it at the end of all visible columns.
treeList1.Columns.Add("Phone");
treeList1.Columns["Phone"].VisibleIndex = treeList1.Columns.Count - 1;
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the VisibleIndex 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.