« on: January 19, 2012, 10:32:48 PM »
Hi,
I am just wondering the best way to handle node control visibility. I have seen in the sample you can show/hide a node control for a certain node liek so:
treeBuckets.NodeControlFilter[node, nsSeparator] = eNodeControlVisibility.Hidden;
however this seems cumbersome and ineffient.
My requirements are to show a control for a certain type of node. By default this node control should be hidden, and then depending on a value on my node derived class, show the control.
It appears there are certain ways to do this:
1. Handle the FilterNodeControl event
2. Set up an ObjectVisibilityManager
Could someone please enlighten me:
public class BucketNode:Node
{
public eType NodeType;
}
if i use this code, it doesnt seem to work:
private void treeBuckets_FilterNodeControl(FlexibleTreeView pTreeview, FilterNodeControlEventArgs pArgs)
{
//This event allows to customize what data is shown in each node control
if (pArgs.Node is BucketNode)
{
BucketNode node = pArgs.Node as BucketNode;
if (pArgs.NodeControl == nNumber)
{
switch (node.NodeType)
{
case eBucketType.btBucket:
case eBucketType.btHeading:
case eBucketType.btMiscBucket:
pArgs.ControlVisibility = eNodeControlVisibility.Hidden;
break;
case eBucketType.btProject:
pArgs.ControlVisibility = eNodeControlVisibility.Visible;
break;
}
}
}
}