|
Load on demand
Saturday, 30 April 2011
By default, when you add an existing node to the treeview, it becomes a part of the treeview hierarchy and will always be displayed in it. There are occasions when you will know which nodes will be displayed in the tree only during run-time. In this case, you will benefit from the load on demand mode of node children nodes, i.e. only as children are needed. Typically, this mode is useful when you need to fill subnodes only when the parent node is expanded (Expanded node property). Example: Node someRootNode = tree.Nodes[0]; someRootNode.LoadOnDemand = true; tree.NodeExpanding += new TreeEventHandler<NodeExpandingEventArgs>(tree_NodeExpanding); private void tree_NodeExpanding(FlexibleTreeView pTreeview, NodeExpandingEventArgs pArgs) { // disable parent node`s load on demand. pArgs.Node.LoadOnDemand = false; // fill children nodes. pArgs.Node.Nodes.Add(new Node("Child node")); } Please note that the node with the LoadOnDemand feature enabled will always display the plus-minus sign, in order to allow the user to expand the node.
|
|