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.v20.1.dll

Declaration

[DefaultValue(-1)]
[XtraSerializableProperty]
public int VisibleIndex { get; set; }
<DefaultValue(-1)>
<XtraSerializableProperty>
Public Property VisibleIndex As Integer

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.

TreeListColumn.VisibleIndex

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.

Examples

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;
See Also