SoFunction
Updated on 2025-03-06

Implementation method of obtaining the visual area child node set under the node DevExpress

Recursively obtaining nodes is a common trick in many program projects. This article uses an example to show the implementation method of obtaining the visual area child node set under the node. I will share it with you for reference. The specific methods are as follows:

The key part of the code is as follows:

/// <summary>
/// Down recursive TreeListNode node/// </summary>
/// <param name="node">Node that requires downward recursion</param>/// <param name="conditionHanlder">Trust</param>public static void DownRecursiveNode(this TreeListNode node, Action&lt;TreeListNode&gt; conditionHanlder)
{
  foreach (TreeListNode _childNode in )
  {
 conditionHanlder(_childNode);
 DownRecursiveNode(_childNode, conditionHanlder);
  }
}
/// &lt;summary&gt;
/// Get the collection of child nodes with visual area under node/// &lt;/summary&gt;
/// <param name="node">Node that needs to obtain visible child nodes</param>/// <param name="conditonHanlder">Conditional delegation</param>/// <returns>Visible child node collection</returns>public static List&lt;TreeListNode&gt; GetVisibleChildNodes(this TreeListNode node, Predicate&lt;TreeListNode&gt; conditonHanlder)
{
  List&lt;TreeListNode&gt; _visibleChildNodes = new List&lt;TreeListNode&gt;();
  TreeList _tree = ;
  DownRecursiveNode(node, n =&gt;
  {
 RowInfo _rowInfo = _tree.[n];
 if (_rowInfo != null)
 {
   if (conditonHanlder(n))
   {
 _visibleChildNodes.Add(n);
   }
 }
  });
  return _visibleChildNodes;
}
/// &lt;summary&gt;
/// Get the collection of child nodes with visual area under node/// &lt;/summary&gt;
/// <param name="node">Node that needs to obtain visible child nodes</param>/// <returns>Visible child node collection</returns>public static List&lt;TreeListNode&gt; GetVisibleChildNodes(this TreeListNode node)
{
  return GetVisibleChildNodes(node, n =&gt; 1 == 1);
}

I hope the methods described in this article will be helpful to everyone's C# programming!