Back to Devexpress

TreeListColumn.VisibleIndex Property

windowsforms-devexpress-dot-xtratreelist-dot-columns-dot-treelistcolumn-e879191a.md

latest8.1 KB
Original Source

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.v25.2.dll

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

Declaration

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

Property Value

TypeDefaultDescription
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.

csharp
treeList1.Columns.Add("Phone");
treeList1.Columns["Phone"].VisibleIndex = treeList1.Columns.Count - 1;
vb
TreeList1.Columns.Add("Phone")
TreeList1.Columns("Phone").VisibleIndex = TreeList1.Columns.Count - 1

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.

winforms-treelist-create-file-manager-drag-drop-files-folders/CS/FileList/FileListHelper.cs#L51

csharp
this.treeListColumn2.FieldName = "Name";
this.treeListColumn2.VisibleIndex = 0;
this.treeListColumn2.Visible = true;

winforms-treelist-virtual-mode/CS/ExampleMainForm.cs#L28

csharp
newColumnDescription.FieldName = "Description";
newColumnDescription.VisibleIndex = 0;

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/Form1.cs#L157

csharp
TreeListColumn col1 = new TreeListColumn();
col1.VisibleIndex = 0;
col1.OptionsColumn.AllowEdit = false;

winforms-spreadsheet-pivot-table-api/CS/SpreadsheetPivotTableExamples/Form1.cs#L145

csharp
TreeListColumn col1 = new TreeListColumn();
col1.VisibleIndex = 0;
col1.OptionsColumn.AllowEdit = false;

winforms-spreadsheetcontrol-api-part-3/CS/SpreadsheetControl_API_Part03/Form1.cs#L318

csharp
TreeListColumn col1 = new TreeListColumn();
col1.VisibleIndex = 0;
col1.OptionsColumn.AllowEdit = false;

winforms-treelist-create-file-manager-drag-drop-files-folders/VB/FileList/FileListHelper.vb#L49

vb
treeListColumn2.FieldName = "Name"
treeListColumn2.VisibleIndex = 0
treeListColumn2.Visible = True

winforms-treelist-virtual-mode/VB/ExampleMainForm.vb#L21

vb
newColumnDescription.FieldName = "Description"
newColumnDescription.VisibleIndex = 0
MyTtreeList.SelectImageList = imageListForTree

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/Form1.vb#L152

vb
Dim col1 As New TreeListColumn()
col1.VisibleIndex = 0
col1.OptionsColumn.AllowEdit = False

winforms-spreadsheet-pivot-table-api/VB/SpreadsheetPivotTableExamples/Form1.vb#L138

vb
Dim col1 As New TreeListColumn()
col1.VisibleIndex = 0
col1.OptionsColumn.AllowEdit = False

winforms-spreadsheetcontrol-api-part-3/VB/SpreadsheetControl_API_Part03/Form1.vb#L321

vb
Dim col1 As TreeListColumn = New TreeListColumn()
col1.VisibleIndex = 0
col1.OptionsColumn.AllowEdit = False

See Also

Visible

VisibleIndex

TreeListColumn Class

TreeListColumn Members

DevExpress.XtraTreeList.Columns Namespace