Hello,
I am trying to populate the NTreeList so I have an organized tree structure to multiple root and child node series. I have populated the Columns and the Root Node but when trying to add subitems I have not been successful. Can someone please explain to me how I can add a root node and then populate that root node with child nodes which populates the listview subitems as well.
namespace test2
{
public partial class Form1 : Form
{
private NTreeNode[] node = new NTreeNode[3];
public Form1()
{
InitializeComponent();
addColumns();
populateRootNodes();
//populateSubNodes();
}
private void addColumns()
{
NTreeListColumn column = new NTreeListColumn();
column.Header.Text = "Dataset";
column.Width = 250;
nDataExplorer.Columns.Add(column);
column = new NTreeListColumn();
column.Header.Text = "Station ID";
column.Width = 250;
nDataExplorer.Columns.Add(column);
column = new NTreeListColumn();
column.Header.Text = "Station Name";
column.Width = 250;
nDataExplorer.Columns.Add(column);
column = new NTreeListColumn();
column.Header.Text = "Station Type";
column.Width = 250;
nDataExplorer.Columns.Add(column);
column = new NTreeListColumn();
column.Header.Text = "Province";
column.Width = 250;
nDataExplorer.Columns.Add(column);
column = new NTreeListColumn();
column.Header.Text = "Samples";
column.Width = 250;
nDataExplorer.Columns.Add(column);
}
private void populateRootNodes()
{
NTreeListColumn column = nDataExplorer.Columns[0];
NTreeListColumn column1 = nDataExplorer.Columns[1];
NTreeNodeCollection children = nDataExplorer.Nodes;
//TreeNodeCollection result = new TreeNode().Nodes;
node[0] = new NTreeNode();
node[0].Text = "Surface Water Quality";
node[1] = new NTreeNode();
node[1].Text = "Pulp Mill Water Quality";
node[2] = new NTreeNode();
node[2].Text = "asdasdasd";
children.AddRange(node);
}
private void populateSubNodes()
{
NTreeListColumn column = nDataExplorer.Columns[0];
NTreeListNode node2;
NTreeListNodeStringSubItem item;
node2 = new NTreeListNode();
node2.ExpandCollapseMode = TreeNodeExpandCollapseMode.Always;
item = new NTreeListNodeStringSubItem();
item.Text = "test";
item.Column = column;
}
}
}