Skip to main content

TreeList.GetVisibleIndexByNode(TreeListNode) Method

Returns the index of the specified node among the visible nodes.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v22.2.dll

NuGet Package: DevExpress.Win.TreeList


public int GetVisibleIndexByNode(
    TreeListNode node


Name Type Description
node TreeListNode

The TreeListNode object representing the node whose visible index is obtained.


Type Description

An integer value specifying the position of the specified node among the visible nodes.


A node is implied invisible if it is a child of a collapsed node. The GetVisibleIndexByNode returns a zero or a greater value when the node is out of the Tree List’s viewable area due to the current scrolling position (see the TreeList.TopVisibleNodeIndex property). This method returns -1 in the cases listed below:

  • the specified node is null (Nothing in Visual Basic);
  • the specified node is a child of a collapsed node.


The sample code below demonstrates how to determine whether a user sees a given node within the Tree List’s scrollable area. The IsNodeVisibleOnScreen method returns false if the node is invisible or only partially visible at the bottom of the Tree List control.

private bool IsNodeVisibleOnScreen(DevExpress.XtraTreeList.Nodes.TreeListNode node) {
   DevExpress.XtraTreeList.TreeList tree = node.TreeList;
   int visibleIndex = tree.GetVisibleIndexByNode(node);
   return visibleIndex >= tree.TopVisibleNodeIndex && visibleIndex < 
     tree.TopVisibleNodeIndex + tree.ViewInfo.VisibleRowCount;
See Also