Flexible TreeView 5.1.9 Help
Column controls. Get started

Column controls are kind of node controls but shown in the treeview columns header. Below the DropDownColumnControl column control is shown that on click shows the dropdown menu.

The column controls can be added to the treeview in two different ways described below.


Add column controls: Visual Studio Forms designer

You can use Visual Studio's Windows Forms designer to add column controls to the treeview. To do that, open the Flexible TreeView Columns treeview property designer, click the particular column where you want to add the column control and open its Controls property designer as shown on the screenshot below.

Now, by clicking the Add button different types of column controls could be added to the selected column.


Add column controls: By code

The other way to add column controls is manually in code. All column controls are linked to the particular column where whey should be shown. To add or remove the column control the TreeColumn.Controls property should be used. For example, below we will add the DropDownColumnControl column control instance to the column.

DropDownColumnControl dropDownControl = new DropDownColumnControl();
ContextMenuStrip columnMenu = new ContextMenuStrip();
ToolStripButton optionsMenuItem = new ToolStripButton("Options", null, OnColumnOptionsClick);
columnMenu.Items.Add(optionsMenuItem);
columnMenu.AutoSize = false;
columnMenu.AutoSize = true;
dropDownControl.DropDownContent = columnMenu;
 
TreeColumn column = new TreeColumn("Order details");
tree.Columns.Add(column);
column.Controls.Add(dropDownControl);
 
void OnColumnOptionsClick(object sender, EventArgs eventArgs)
{
  MessageBox.Show("Show column options");
}
Dim dropDownControl As New DropDownColumnControl()
Dim columnMenu As New ContextMenuStrip()
Dim optionsMenuItem As New ToolStripButton("Options", Nothing, OnColumnOptionsClick)
columnMenu.Items.Add(optionsMenuItem)
columnMenu.AutoSize = False
columnMenu.AutoSize = True
dropDownControl.DropDownContent = columnMenu

Dim column As New TreeColumn("Order details")
tree.Columns.Add(column)
column.Controls.Add(dropDownControl)

Private Sub OnColumnOptionsClick(sender As Object, eventArgs As EventArgs)
    MessageBox.Show("Show column options")
End Sub

 

 


Copyright © 2006-2016 ARMSoft

www.FlexibleTreeView.com