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";
ncText.AttachTo(tree);


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


Dim node As New Node("Simple node")
node.AttachTo(tree)

 

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.

 

Nodes


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";
ncUserName.AttachTo(tree);

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

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


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

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

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


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

 

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";
ncOrderTitle.AttachTo(tree);

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

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


// Add node.
OrderNode node = new OrderNode();
node.Text = "First order";
node.OrderId = 1;
node.OrderAmount = 100;
node.AttachTo(tree);
' Custom node class.
Class OrderNode
    Inherits Node
    Public Property OrderId() As Integer
        Get
            Return m_OrderId
        End Get
        Set
            m_OrderId = Value
        End Set
    End Property
    Private m_OrderId As Integer
    Public Property OrderAmount() As Decimal
        Get
            Return m_OrderAmount
        End Get
        Set
            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"
ncOrderTitle.AttachTo(tree)

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

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


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

To get more about nodes read this introductory topic.

 

 

Columns


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");
column.AttachTo(tree);

// Add node controls.
NodeTextBox ncOrderTitle = new NodeTextBox();
ncOrderTitle.AttachToColumn(column);
ncOrderTitle.AttachTo(tree);

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

' Add node controls.
Dim ncOrderTitle As New NodeTextBox()
ncOrderTitle.AttachToColumn(column)
ncOrderTitle.AttachTo(tree)

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

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


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

www.FlexibleTreeView.com