Besides the simple, easy binding, WebTreeView.NET® 1.0 is also equipped with a lot of properties you can set. This can be accessible if you add a node to the Selected data bindings box and select it. Please see the screenshot below:
Following is the list of available properties you can set:
|DataMember||Get or set the Data Member.|
|Depth||Gets or set the Depth of the databinding.|
|AllowEditingField||Sets a node edit ability based on the XML.|
|CheckedField||Initially check or uncheck node when ShowCheckBox property is set to true.|
|CheckedStateField||Initially sets the checked state of a node when ShowCheckBox property is set to true.|
|EnabledField||Enables or disables node based on the XML.|
|ExpandedField||Expands or collapses node based on the XML.|
|ExpandedImageField||Sets the expanded node image icon based on the XML.|
|ImageField||Sets the collapsed node image icon based on the XML.|
|ImageToolTipField||Sets the tooltip image icon based on the XML.|
|MaxBindingDepthField||Sets the node level you want to bind based on the XML.|
|NavigateURLField||Sets the URL when a node is selected based on the XML.|
|SelectableField||Specifies if a node is selected or not based on the XML.|
|SelectedImageField||Sets the collapse icon image of the selected node based on the XML.|
|ShowCheckBoxField||Shows or hides check box based on the XML.|
|TagField||Gets or sets a string which contains data about the WebTreeViewNode.|
|TargetField||Specifies the target window when the node is clicked based on the XML.|
|TextField||Sets the text of a node that you want to display based on the XML.|
|ToolTipField||Sets the tooltip of a node based on the XML.|
|VisibleField||Sets the visibility of a node based on the XML.|
|AllowEditiing||Sets a node edit ability.|
|Checked||Check or uncheck a node.|
|CheckedState||Sets the checked state of a node.|
|Enabled||Enables or disables node.|
|Expanded||Expands or collapses node.|
|ExpandedImage||Sets the image icon of expanded node.|
|Image||Sets the image icon of collapsed node.|
|ImageToolTip||Sets the tooltip image icon of a node.|
|MaxBindingDepth||Sets the node level you want to bind.|
|NavigateURL||Sets the URL when a node is selected.|
|Selectable||Sets a node's selected ability.|
|Selected||Specifies if a node is selected or not.|
|SelectedExpandedImage||Sets the expand icon image of the selected node.|
|SelectedImage||Sets the collapse icon image of the selected node.|
|ShowCheckBox||Shows or hides check box.|
|Tag||Gets or sets a string which contains data about the WebTreeViewNode.|
|Target||Sets the target window when a node is clicked.|
|Text||Sets the text of a node.|
|ToolTip||Sets the tooltip of a node.|
|Value||Sets the value of a node.|
|Visible||Sets the visibility of a node.|
Notice that both Databindings properties and Default properties are identical. The difference between them is, you can set each property value under the Databindings based on the value specified on your XML. This approach is designed to provide you with a hassle-free data binding process. You only need to set the structure of your Treeview and its properties in your XML file.
A sample of XML file which can be bound to WebTreeView.NET® 1.0
The Depth property allows you to controls which node level you want the properties to be applied. One thing you should note is that this only applicable to the same XML name. The default value for this property is -1 which means all properties will be applied to the same XML name. If you set the value to 0 (the index of a node), the properties will only be applied to all index 0 nodes.
There are some scenarios when you have two different node levels, but both nodes have the same DataMember and you need to set the different properties for each node level. This is the case when you need to change the Depth's value based on the node's index that you want to set to. Have a look at the image below and you will see that there are two different node levels, but same DataMember.
If you leave Depth to its default value, the Selectable properties will be applied to all nodes. You need to set the Depth to 1, if you want to apply the Selectable to "WebCombo.NET" node only. Set it to 2 if you want to apply the Selectable to "WebCombo.NET 2.0" node, "WebCombo.NET 3.0" node, and "WebCombo.NET 4.0" node.
MaxBindingDepth is a property which allows you to select how many child nodes you want to bind. This feature will be a great help when you have deep-structured XML and for example, you want to bind a parent node and the first level child node. WebTreeView provides you MaxBindingDepth property to achieve your scenario.
You only need to add a node to the Selected databindings box and set the MaxBindingDepth value to the desired child node level. Please note that the value of the MaxBindingDepth property is based on how many child node level you want to bind, so this is a relative value, not absolute value. For example, you have a deep-structured XML and you want to bind a parent node and level three child nodes only.
Notice that the grayed part will be the child nodes of Parent 2 node
Select the Parent node and add it to the Selected data bindigs box.
Set the MaxBindingDepth to 3
Run your project and it will look like the following screenshot.