Flexible TreeView 5.1.9 Help
NodeExpandableTextBox node control

NodeExpandableTextBox allows you to show a text title if node is not selected, focused, or under the mouse cursor, and the title and additional text description if the node is selected, focused, or under the mouse cursor. This allows you to not overload the treeview with information, to be intuitive and understandable, while at the same time to provide more information on the selected node.

Note that the Options.Node.AutoNodeHeight treeview option must be enabled to show an expandable node control.


The main elements of the NodeExpandableTextBox node control are a title and description:

 

The NodeExpandableTextBox may be in three states:

Example:

NodeExpandableTextBox name = new NodeExpandableTextBox();
name.AttachTo(tree);
 
// add node to the treeview.
NodeWithDescription node = new NodeWithDescription();
node.Text = "Node title";
node.Description = "Node description";
node.AttachTo(tree);
 
// prepare treeview to auto-expanding.
tree.Options.Node.AutoNodeHeight = true;
Dim name As New NodeExpandableTextBox()
name.AttachTo(tree)

' add node to the treeview.
Dim node As New NodeWithDescription()
node.Text = "Node title"
node.Description = "Node description"
node.AttachTo(tree)

' prepare treeview to auto-expanding.
tree.Options.Node.AutoNodeHeight = True

 

Title

Title allows you to display short textual information and it is always displayed for a non-expanded node. For an expanded node, it is displayed only when the ShowTitleWhenExpanded is enabled (enabled by default).
To bind a title to a node class's member, set that member name in the DataFieldName node control property (it is set to 'Text' by default), or supply the title text dynamically when the VirtualMode is enabled by subscribing to the NodeControlValueGet treeview event.

You can easily set the title's style and behavior using these properties:


Title style

You can easily combine the title text's style with the node control's style by using the TitleStyle.Weak property. If it is enabled, the title style combines with the node control style. If it is disabled, only the TitleStyle property settings will be used as a title text style.



Description

Description allows you to display additional information about an expanded node when it is selected, focused, or under the mouse cursor, and soft selection is enabled. If you need the description to always show, disable the AutoExpand property.
To bind the description to a node, adjust the appropriate node class's member in the DescriptionDataFieldName property. The bound member should be of String type.
You can easily set the description's style and behavior using these properties:


Description style

You can easily combine the description text's style with the node control's style by using the DescriptionStyle.Weak property. If it is enabled, the description style combines with the node control style. If it is disabled, only the DescriptionStyle property settings will be used as a description text style.


Expanding

The node expansion is controlled by these parameters:

To change the node control expansion behavior (by default it shows expanded in a node when AllowExpand and AutoExpand properties are equal to TRUE and node is focused or soft-selected) the IsExpanded method should be overridden as shown below.

class CustomNodeExpandableTextBox : NodeExpandableTextBox
{
  protected override bool IsExpanded(Node pNode, DrawContext pContext)
  {
    if(pNode.Text == "Root")
      return true;

    return base.IsExpanded(pNode, pContext);
  }
}
Class CustomNodeExpandableTextBox
    Inherits NodeExpandableTextBox
    Protected Overrides Function IsExpanded(pNode As Node, pContext As DrawContext) As Boolean
        If pNode.Text = "Root" Then
            Return True
        End If

        Return MyBase.IsExpanded(pNode, pContext)
    End Function
End Class


HTML support

The title and description supports HTML text display by enabling the TitleSupportHtml and DescriptionSupportHtml properties respectively.


Text auto-wrapping

Also, title and description supports text auto-wrapping if it exceed the column or treeview width. To enable it, set the wrap mode in the TitleWrapMode and DescriptionWrapMode properties respectively.

 

 


Copyright © 2006-2016 ARMSoft

www.FlexibleTreeView.com