MultiColumnTreeView Features in Windows Forms MultiColumn TreeView

8 Jul 20266 minutes to read

MultiColumnTreeView contains following features,

NodeSelection

SelectionMode

SelectionMode defines the ability to select a number of nodes at a time. The following three modes are available:

  • Single – Allows the user to select only a single node.

  • MultiSelectSameLevel – Allows multi-selection only when the multiple nodes are at the same level.

  • MultiSelectAll – Allows multi-selection of nodes irrespective of node level.

this.MultiColumnTreeView1.SelectionMode = Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeSelectionMode.MultiSelectAll;
Me.MultiColumnTreeView1.SelectionMode = Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeSelectionMode.MultiSelectAll

MultiColumnTreeView-Features_img1

SelectedNode property gets the node value when the user selects a node in the MulticolumnTreeView.
This property will be useful when the Selection Mode is Single.

SelectedNode can also be used to set a node as selected.

this.MultiColumnTreeView1.SelectedNode = this.MultiColumnTreeView1.Nodes[0].Nodes[1];
Me.MultiColumnTreeView1.SelectedNode = Me.MultiColumnTreeView1.Nodes(0).Nodes(1)

SelectedNodes is used to get the nodes selected in MultiColumnTreeView, it can be used in all selection modes .

ActiveNode is the node that is being active, it allows to get or set a node as ActiveNode at an instance.

this.MultiColumnTreeView1.ActiveNode = this.MultiColumnTreeView1.Nodes[4].Nodes[1];
Me.MultiColumnTreeView1.ActiveNode = Me.MultiColumnTreeView1.Nodes(4).Nodes(1)

Keyboard-Based and Mouse-Based Selection

Mouse-based selection allows the user to select the nodes using a mouse drag. Simply click on any area in MultiColumnTreeView and drag. All the nodes available in the drag region will be selected.
Use the property AllowMouseBasedSelection to select nodes using the mouse.

this.MultiColumnTreeView1.AllowMouseBasedSelection = true;
Me.MultiColumnTreeView1.AllowMouseBasedSelection = True

MultiColumnTreeView-Features_img2

MultiColumnTreeView supports searching for nodes using the keyboard. Tap any letter on the keyboard and MultiColumnTreeView will show the node starting with that letter. Keep tapping the same letter to cycle through all the nodes starting with it.

this.MultiColumnTreeView1.AllowKeyboardSearch = true;
Me.MultiColumnTreeView1.AllowKeyboardSearch = True

Auto Size for Columns

MultiColumnTreeView supports calculating the width of nodes and sub-items based on the width of the text and images they contain, and assigns the largest node width to its column.

This is controlled by the AutoSizeMode property, which has the following options:

  • None – No auto-size is applied to the columns.
  • AllCellsExceptHeader – Calculates the node width and assigns it to the column. The width of the header text is not included in the calculation.
this.multiColumnTreeView1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.AutoSizeMode.AllCellsExceptHeader;
Me.multiColumnTreeView1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.AutoSizeMode.AllCellsExceptHeader

MultiColumnTreeView-Features_img3

Undo & Redo

The Undo action erases the last change made to a node and reverts it to the previous state.

Redo is the opposite of Undo. The redo command reverses the Undo and returns the node to the current state. Redo can be performed only after an Undo action.
Actions can be recorded in the history manager so that Undo and Redo operations can be performed.

Property Table

MultiColumnTreeView Property Description
HistoryManager To record the actions performed

HistoryManager Method Table

HistoryManager Tool Description
Undo Undo the previous action.
Redo Redo the previous action. Redo action can be performed only after an undo action.
this.multiColumnTreeView1.HistoryManager.Undo();

this.multiColumnTreeView1.HistoryManager.Redo();
Me.multiColumnTreeView1.HistoryManager.Undo()
    Me.multiColumnTreeView1.HistoryManager.Redo()

Tooltip and Help Text

Help Text

HelpText is a popup that appears when hovered on any node or SubItem, it will display the information given to that HelpText property.

Assigning help text to a node

this.multiColumnTreeView1.Nodes[0].Node[0].HelpText = "India and New Delhi";
Me.multiColumnTreeView1.Nodes(0).Node(0).HelpText = "India and New Delhi"

Assigning help text to a subItem

this.multiColumnTreeView1.Nodes[0].Node[0].SubItems[1].HelpText = "Capital of India";
Me.multiColumnTreeView1.Nodes(0).Node(0).SubItems(1).HelpText = "Capital of India"

MultiColumnTreeView-Features_img4

ToolTip

ToolTip is a special control which automatically appears as a popup when a node is partially visible. It displays the total text of the node.

MultiColumnTreeView-Features_img5

Performance

The MultiColumnTreeView performance can be improved with the following properties and methods.

SuspendExpandRecalculate

When the SuspendExpandRecalculate property is set to true, the populating time is nearly halved by recalculating the maximum height of the nodes only while expanding and collapsing.

this.multiColumnTreeView1.SuspendExpandRecalculate = true;
Me.multiColumnTreeView1.SuspendExpandRecalculate = True
MultiColumnTreeView Methods Description
BeginUpdate Calling this method will stop the redraws of the control and makes the node addition faster than normal.
EndUpdate Resumes the painting of the control suspended by BeginUpdate method.
this.multiColumnTreeView1.BeginUpdate();

//Add more node here

this.multiColumnTreeView1.EndUpdate();
Me.multiColumnTreeView1.BeginUpdate()

' Add more node here

Me.multiColumnTreeView1.EndUpdate()