Get started
Flexible TreeView may show nodes either within an unlimited width or within columns. You can add or remove columns using the Columns treeview 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)
Note
The default width of a column is 150 pixels. To make it wider, use the Width
property.
Searching columns#
There are several methods to find an existing column by different parameters, all provided by the Columns treeview property.
Finding by title#
The Find(string) method allows you to find a column by its title text stored in the Text property:
Finding by column identifier#
The overloaded method Find(int) allows you to find a column by its unique identifier stored in the Id column property:
Finding by mouse position#
Another overloaded method Find(Point) allows you to find a column by the passed mouse cursor location and returns an 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 the mouse cursor is over the column's resize delimiter line (IsOnResizeLine property):
Note
The passed point parameter value should contain the treeview's local location, i.e., starting at the top-left corner of the treeview's client area, and the Y value of this parameter should be within the treeview columns header height.
Finding by horizontal position#
Also, Flexible TreeView provides the possibility to find the column by horizontal position using the GetColumnAt(int) method as shown below. Compared to the Find(Point) method, the GetColumnAt method does not require or check the vertical position of the location:
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 its 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 can override them by using the Images treeview property.
Additional API Reference#
Properties#
- Treeview.Options.Column.ShowVertLines - defines whether to show vertical lines that delimit columns.
- Treeview.ColumnHeaderHeight - the columns header height.
Events#
- Treeview.ColumnInserted - raises when a column is added to the treeview.
- Treeview.ColumnRemoved - raises when a column is removed from the treeview.
- Treeview.ColumnSortOrderChanging - raises when the column sort order is changing.
- Treeview.ColumnSortOrderChanged - raises when the column sort order is changed.
- Treeview.ColumnWidthChanged - raises when the column width is changed.
- Treeview.ColumnVisibilityChanged - raises when the column is hidden or shown.
- Treeview.ColumnIndexChanging - raises when the column index is changing.
- Treeview.ColumnIndexChanged - raises when the column index is changed.
- Treeview.ColumnMenuShowing - raises when the column context menu is showing.