A newer version of this page is available. Switch to the current version.

TreeList.AppendNode(Object, TreeListNode) Method

Adds a new TreeListNode containing the specified values to the XtraTreeList.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.1.dll


public virtual TreeListNode AppendNode(
    object nodeData,
    TreeListNode parentNode


Name Type Description
nodeData Object

An array of values or a DataRow object, used to initialize the created node’s cells.

parentNode TreeListNode

A parent node of the added one.


Type Description

A TreeListNode object representing the added node.


Use the AppendNode method to append a new node to the specified node’s child collection. Use the parentNode parameter to specify the parent node. To add a node at the root level, set the parentNode parameter to null.

The nodeData parameter specifies data for the columns of the node that is to be created. This parameter value can be an array of values or a DataRow object. The number and order of items in the array/DataRow object must match the number and order of Tree List columns.

Refer to the Nodes topic to learn more.


The following code shows how to manually populate a TreeList control with nodes in unbound mode.

To add nodes in unbound mode, utilize the TreeList.AppendNode method. Data that is passed to this method must match the TreeList columns. So, the TreeList columns are created before the nodes are created.

Note that calls to the methods used to create nodes are wrapped with the TreeList.BeginUnboundLoad and TreeList.EndUnboundLoad methods. This reduces the control’s updates to a minimum, and thus improves performance.

The following image displays the result.


using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Columns;
using DevExpress.XtraTreeList.Nodes;

private void Form1_Load(object sender, EventArgs e) {

private void CreateColumns(TreeList tl) {
    // Create three columns
    TreeListColumn col1 = tl.Columns.Add();
    col1.FieldName = "Customer";
    col1.Caption = "Customer";
    col1.VisibleIndex = 0;
    TreeListColumn col2 = tl.Columns.Add();
    col2.FieldName = "Location";
    col2.Caption = "Location";
    col2.VisibleIndex = 1;
    TreeListColumn col3 = tl.Columns.Add();
    col3.FieldName = "Phone";
    col3.Caption = "Phone";
    col3.VisibleIndex = 2;

private void CreateNodes(TreeList tl) {
    // Create a root node
    TreeListNode parentForRootNodes = null;
    TreeListNode rootNode = tl.AppendNode(
        new object[] { "Alfreds Futterkiste", "Germany, Obere Str. 57", "030-0074321" },
    // Create a child of the rootNode
    tl.AppendNode(new object[] { "Suyama, Michael", "Obere Str. 55", "030-0074263" }, rootNode);
    // Create more nodes
    // ...
See Also