Flexible TreeView 5.1.9 Help
Columns. Get started

Flexible TreeView may show nodes either within an unlimited width or within columns. You can add or remove columns using the Columns property, either in the Visual Studio designer or programmatically as shown below.

// add column.
TreeColumn col = new TreeColumn();   
// or new TreeColumn("Column title", 100);
col.Text = "Column title";
col.Width = 100;
tree.Columns.Add(col);
 
// attach node control.
NodeTextBox tb = new NodeTextBox();
tb.AttachToColumn(col);              
// or tb.ColumnId = col.Id;
tb.AttachTo(tree);
 
// add node.
Node node = new Node("test");
node.AttachTo(tree);
' add column.
Dim col As New TreeColumn()
' or new TreeColumn("Column title", 100);
col.Text = "Column title"
col.Width = 100
tree.Columns.Add(col)

' attach node control.
Dim tb As New NodeTextBox()
tb.AttachToColumn(col)
' or tb.ColumnId = col.Id;
tb.AttachTo(tree)

' add node.
Dim node As New Node("test")
node.AttachTo(tree)

 

Searching for columns

There are couple of methods to find an existing column by different parameters and all those methods are provided by the Columns treeview property.
The Find(string) method allows to find a column by its title text that is stored in the Text property:

TreeColumn column = tree.Columns.Find("Order number");
Dim column As TreeColumn = tree.Columns.Find("Order number")

The overloaded method Find(int) allows to find a column by its unique identifier that is stored in the Id column property:

TreeColumn column = tree.Columns.Find(3);
Dim column As TreeColumn = tree.Columns.Find(3)


Other overloaded method Find(Point) allows to find a column by the passed mouse cursor location and returns the object of type ARMSoft.FlexibleTreeView.Column.ColumnTracking. The returned object contains information about the found column (Column property) or the column control (ColumnControl property) that's under the mouse cursor and whether mouse cursor is over the column's resize delimiter line (IsOnResizeLine property):

ColumnTracking columnTracking = tree.Columns.Find(Control.MousePosition);
if(columnTracking.Column != null && (columnTracking.IsOnResizeLine || columnTracking.ColumnControl != null))
{
  columnTracking.Column.Text = "Is under mouse cursor";
}
Dim columnTracking As ColumnTracking = tree.Columns.Find(Control.MousePosition)
If columnTracking.Column IsNot Nothing AndAlso (columnTracking.IsOnResizeLine OrElse columnTracking.ColumnControl IsNot Nothing) Then
    columnTracking.Column.Text = "Is under mouse cursor"
End If

Note that the passed point parameter value should contain treeview local location, i.e. start at the top-left corner of the treeview's client area and Y value of this parameter value should be within the treeview columns header height.

Also, Flexible TreeView provides the possibility to find the column by horizontal position using the GetColumnAt(int) method as shown below. Comparing to the Find(Point) method GetColumnAt method does not require or check the vertical position of the location.

TreeColumn column = tree.Columns.GetColumnAt(Control.MousePosition.X);
Dim column As TreeColumn = tree.Columns.GetColumnAt(Control.MousePosition.X)


Node controls binding

Every column shows only those node controls, that are bound to it and visible. To bind a node control to the column, set the ColumnId node control property to a target column Id property value or set the Column property to a column instance.


Visibility

By default, a newly added column is visible in the treeview, but you can hide it by disabling the Visible property. When column visibility changes, the treeview raises the ColumnVisibilityChanged event.


Override column icons

By default, Flexible TreeView uses system or Office2007 theme column icons but you are able to override them by using the Images treeview property.


Additional API reference

Properties

Events

 

 


Copyright © 2006-2016 ARMSoft

www.FlexibleTreeView.com