C#TreeViewAdv - 动态添加列

时间:2015-08-06 13:46:24

标签: c# treeview multiple-columns

我正在使用TreeViewAdv。我知道如何使用固定数量的列创建树。我在表单中删除TreeView并添加列和nodecontrols。

 private class ColumnNode: Node
    {
        public string NodeControl1="";  // This should make the DataPropertyName specified in the Node Collection.
        public string NodeControl2 = "";
        public string NodeControl3 = "";
        public ColumnNode(string nodeControl1, string nodeControl2, int nodeControl3)
            : base(form)
        {
            NodeControl1 = nodeControl1;
            NodeControl2 = nodeControl2;
            NodeControl3 = nodeControl3.ToString();
        }
    }

然后我像这样加载树:

_treeViewAdv.Model = _model;
_treeViewAdv.BeginUpdate();
for (int i = 0; i < 20; i++)
{

    Node parentNode = new ColumnNode("root" + i, "",0);
    _model.Nodes.Add(parentNode);

    for (int n = 0; n < 2; n++)
    {
        Node childNode = new ColumnNode("child" + n,"Further Information",1);
        parentNode.Nodes.Add(childNode); 
    }

}
_treeViewAdv.EndUpdate();

但是可以创建动态数量的列吗?

0 个答案:

没有答案