« Reply #4 on: March 31, 2009, 04:18:41 PM »
Hello, Anand.
We`ve prepared an explorer-only sample project for VS2008. Please view the attached file and run compiled .exe in the Bin folder.
>Also I would like to ask you that is it possible to show checkboxes in front of each node ( i.e. to check the node).
Yes, of course, you can have unlimited quantity of the node controls (see below) which will display a node`s class data. This can be check boxs, radio buttons, textes, images, combo boxes, numerics, expandable texts, expandable custom contexts etc. FTV does`nt limit you!
Now let me to make an introduction to the FTV backgrounds before you can read it in our Knowledge Base later:
All treeview`s content is constructed by placeholders - Node Controls (see the NodeControls treeview`s property in the VS properties window) which are bounded to the node`s class member and will show it in the tree. So, for instance, if you need to show a check box (icon only! without text) you`ll need to add the NodeCheckBox node control in the VS designer and adjust the node control`s Visible property to the True.
Every node control bounded to the node`s class member which name is stated in the NodeConrol.DataFieldName property. For instance, every node (FlexibleTreeView.Node class) has the CheckState built-in property to which the NodeCheckBox is bounded by default (DataFieldName="CheckState"), so you don`t need any additional properties changes for this node control in the designer! Just drop it and add nodes to a tree.
On the other hand, every node control is bounded to the area, where it will be displayed like treeview`s column or treeview itself, if it does`nt have any column. So if your treeview has any column you need to bind a node control to the appropriate column where you want to display this node control. To do that open the treeview.Columns property VS designer, find an appropriate column and remember the Id property value. Then open node controls VS designer and past it to the appropriate node control`s ColumnId property. That`s all. Changing the ColumnId value you`ll move this node control between columns.
So to show some content in the tree follow next steps:
1) add (in the NodeControls property designer) appropriate node controls to the tree according to which content you want to show (for instance, for text content it`s the NodeTextBox, for image it`s NodeImage etc.) and adjust the DataFieldName property to the Node`s class field name from where to get a content. For instance, to show a text, adjust it to the 'Text' value etc. ARMSoft.FlexibleTreeView.Node has the Text and CheckState built-in useful properties.
2) adjust some general settings to the treeview itself like a static or dynamic node height (Options->Node->AutoNodeHeight) etc.
3) add nodes to the treeview (for now there`s no visual node designer. It will come in the near next releases):
to show a text do:
Node node;
node = new Node("Sample text");
node.Attach(treeview); // add node to the tree`s root
to show an image:
NodeWithImage nodeImage;
nodeImage = new NodeWithImage(null, someImage); // someImage is an image instance
node.Attach(treeview); // add node to the tree`s root
to show a check box (only check image, without text! To add a text, add the NodeTextBox node control later):
Node node;
node = new Node("Sample text");
node.CheckState = ARMSoft.FlexibleTreeView.eCheckState.Checked;
node.Attach(treeview); // add node to the tree`s root
Please note that you add as many node controls as many data you need to display.
To add some non-standart properties/behavior to the node class just derive your class from the ARMSoft.FlexibleTreeView.Node class and bind node controls to your class`s members.
Moreover, you can add to the treeview any Node derived classes instances simultaneously:
Node node = new Node("Native node").AttachTo(tree);
class MyNode : Node
{
private string CustomTextToShow;
}
MyNode myNode = new Node("Custom node").AttachTo(tree);
Now you know how to construct the treeview`s view parts and how to fill that treeview with data (nodes).
If you have any other questions feel free to ask us.