Flexible TreeView 5.1.9 Help
Where to start

Flexible TreeView has a quite difference paradigm of data presentation and manipulation as comparing to standard treeview controls on the market. This is needed to be fast and flexible to meet the project requirements.

There could be some misunderstanding of how to start using Flexible TreeView, so below is the step-by-step guidance of how to jump in smoothly.


Node controls

Node controls are the core difference of Flexible TreeView and other treeview controls. The purpose of node controls is to get the data somewhere (in a node instance, from outside, etc.) and present it in a specified format in the treeview. I.e. it is like a data presenter. Also, node controls allows to edit and update that data by user.

At least one node control must be added to the treeview in order to display your data there!
If you see nodes (can select them) but no data in the treeview then there are couple of possible reasons, either there were no node controls added into the treeview or your data binding is broken or your data is actually empty.

To start with node controls the following example could be used that just adds a textbox node control and a node with title that's displayed by this node control.

NodeTextBox ncText = new NodeTextBox();
ncText.DataFieldName = "Text";

Node node = new Node("Simple node");
Dim ncText As New NodeTextBox()
ncText.DataFieldName = "Text"

Dim node As New Node("Simple node")


If treeview has any column each node control must be attached to its column! Otherwise, such a node control won't be visible in the treeview.

To get more about node controls read this introductory topic.



Node is a "data" container for treeview, i.e. in most cases, except in data bound mode, the node contain the data to be shown in the treeview.

Each node's data property that need to be shown in the treeview must be bound to an appropriate node control via DataFieldName as shown here!

The Node built-in class already contain some data properties, like TextCheckState and Tag, that could be used to store user data and show it in treeview, as shown below.

// Add node controls.
NodeTextBox ncUserName = new NodeTextBox();
ncUserName.DataFieldName = "Text";

NodeCheckBox ncUserVerified = new NodeCheckBox();
ncUserVerified.DataFieldName = "CheckState";

NodeTextBox ncUserTag = new NodeTextBox();
ncUserTag.DataFieldName = "Tag";

// Add nodes.
Node node = new Node("John Smith");
node.CheckState = eCheckState.Checked;
node.Tag = "Dummy user";
' Add node controls.
Dim ncUserName As New NodeTextBox()
ncUserName.DataFieldName = "Text"

Dim ncUserVerified As New NodeCheckBox()
ncUserVerified.DataFieldName = "CheckState"

Dim ncUserTag As New NodeTextBox()
ncUserTag.DataFieldName = "Tag"

' Add nodes.
Dim node As New Node("John Smith")
node.CheckState = eCheckState.Checked
node.Tag = "Dummy user"


In case more data properties are needed a class that inherits Node class with required data properties need to be declared, as shown below.  

// Custom node class.
class OrderNode : Node
  public int OrderId { get; set; }
  public decimal OrderAmount { get; set; }

// Add node controls that handle these new data properties.
NodeTextBox ncOrderTitle = new NodeTextBox();
ncOrderTitle.DataFieldName = "Text";

NodeNumeric ncOrderId = new NodeNumeric();
ncOrderId.DataFieldName = "OrderId";

NodeNumeric ncOrderAmount = new NodeNumeric();
ncOrderAmount.DataFieldName = "OrderAmount";

// Add node.
OrderNode node = new OrderNode();
node.Text = "First order";
node.OrderId = 1;
node.OrderAmount = 100;
' Custom node class.
Class OrderNode
    Inherits Node
    Public Property OrderId() As Integer
            Return m_OrderId
        End Get
            m_OrderId = Value
        End Set
    End Property
    Private m_OrderId As Integer
    Public Property OrderAmount() As Decimal
            Return m_OrderAmount
        End Get
            m_OrderAmount = Value
        End Set
    End Property
    Private m_OrderAmount As Decimal
End Class

' Add node controls that handle these new data properties.
Dim ncOrderTitle As New NodeTextBox()
ncOrderTitle.DataFieldName = "Text"

Dim ncOrderId As New NodeNumeric()
ncOrderId.DataFieldName = "OrderId"

Dim ncOrderAmount As New NodeNumeric()
ncOrderAmount.DataFieldName = "OrderAmount"

' Add node.
Dim node As New OrderNode()
node.Text = "First order"
node.OrderId = 1
node.OrderAmount = 100

To get more about nodes read this introductory topic.




Columns are intended to visually divide the data rows inside a treeview.

Because the data is presented only by node controls, each node control must be bound to the column, otherwise, such a node control won't be visible in treeview!

To add a column an instance of TreeColumn class need to be created, as shown below.


// Add columns.
TreeColumn column = new TreeColumn("Title");

// Add node controls.
NodeTextBox ncOrderTitle = new NodeTextBox();

// Add nodes.
Node node = new Node("Some text");
' Add columns.
Dim column As New TreeColumn("Title")

' Add node controls.
Dim ncOrderTitle As New NodeTextBox()

' Add nodes.
Dim node As New Node("Some text")

The column default width is 150 pixels, so to make it wider the Width property should be used.


To get more about columns read this introductory topic.




Treeview is an aggregating "container" for node controls, nodes and columns. To get access to node controls, nodes and columns the NodeControlsNodes and Columns properties should be used respectively.

To get more about the treeview read this introductory topic.




Copyright © 2006-2016 ARMSoft