Back to Devexpress

TreeList.TopVisibleNodeIndex Property

windowsforms-devexpress-dot-xtratreelist-dot-treelist-d3a4bab6.md

latest4.1 KB
Original Source

TreeList.TopVisibleNodeIndex Property

Gets or sets the index of the top visible node.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

csharp
[Browsable(false)]
public int TopVisibleNodeIndex { get; set; }
vb
<Browsable(False)>
Public Property TopVisibleNodeIndex As Integer

Property Value

TypeDescription
Int32

An integer value specifying the zero-based index of the top visible node.

|

Remarks

If the total node height exceeds the TreeList control’s client area, end-users can scroll the control’s contents vertically. You can use the TopVisibleNodeIndex property to obtain the index of the top visible node. Assigning a value to this property results in scrolling to the specified node. Note that if the specified node is hidden within the collapsed group, its closest visible parent becomes the topmost item.

Write a TreeList.TopVisibleNodeIndexChanged event handler to perform specific actions each time the control’s content is vertically scrolled.

The following code snippets (auto-collected from DevExpress Examples) contain references to the TopVisibleNodeIndex 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-save-restore-expanded-state-of-nodes/CS/TreeListViewState.cs#L61

csharp
if(topVisibleNode == null) topVisibleNode = TreeList.FocusedNode;
    TreeList.TopVisibleNodeIndex = TreeList.GetVisibleIndexByNode(topVisibleNode);
}

winforms-tokenedit-dropdown-with-treelist/CS/TokenEditTest/CustomTokenEditDropDownControl.cs#L62

csharp
if(e.Delta > 0) step *= -1;
    TreeList.TopVisibleNodeIndex += step;
}

winforms-treelist-save-restore-expanded-state-of-nodes/VB/TreeListViewState.vb#L68

vb
End If
    TreeList.TopVisibleNodeIndex = TreeList.GetVisibleIndexByNode(topVisibleNode)
End Try

winforms-tokenedit-dropdown-with-treelist/VB/TokenEditTest/CustomTokenEditDropDownControl.vb#L70

vb
End If
    TreeList.TopVisibleNodeIndex += [step]
End Sub

See Also

LeftCoord

LeftCoordChanged

TopVisibleNodePixel

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace