Flexible TreeView Flexible TreeView


Support & Community

Load on demand

Previous Table of Contents Next

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).
To activate this mode, you must set the value of the parent node’s LoadOnDemand property to TRUE and subscribe to the NodeExpanding treeview event, which is raised upon node expansion. In the event handler, you have to add subnodes to the expanded node and, optionally, disable the LoadOnDemand property, if the subnodes list won't alter.

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.

Previous Top Next


Last news
Bookmark and Share
Flexible TreeView on Twitter
Sunday, 04 March 2012

Flexible TreeView goes social! Twitter account and 10% discount for first followers!

Use Flexible TreeView in WPF project
Sunday, 18 December 2011

Do you have a WPF project and want to use Flexible TreeView there? No problem!

Flexible TreeView v3.4
Friday, 16 December 2011

Flexible TreeView v3.4 maintenance release has been released.

Latest release

Version:
Release date:
3.4
Dec 16, 2011


Copyright © 2006-2012 ARMSoft. All rights reserved.