Flexible TreeView Flexible TreeView


Support & Community

NodeComboBox node control

Previous Table of Contents Next

NodeComboBox allows you to show an item from a list and edit it using the combobox control. This node control tracks the selected item`s index, so you need to bind it to any numeric type that can be converted to the System.Int type. To supply combobox items use the DropDownItems property.

Example:

NodeComboBox cb = new NodeComboBox();
cb.AttachTo(tree);
// define the combobox items list.
string[] objects = new[] { "First", "Second", "Third" };
cb.DropDownItems = new List<object>(objects);
 
// bind the node control to the node`s member where the selected index will be stored.
cb.DataFieldName = "Position";
 
NodeEx node = new NodeEx();
// second position (zero based) by default is selected.
node.Position = 1;
node.AttachTo(tree);


Also, you can create an items list dynamically by enabling the InteractiveDropDownItems property and subscribing to the NodeComboBoxGetItems treeview event, as shown below.

Example:

// Custom node class to hold the selected item index.
class NodeEx : Node
{
  public int Id;
}
 
NodeComboBox cb = new NodeComboBox();
// enable the dynamic combobox items mode.
cb.InteractiveDropDownItems = true;
cb.DataFieldName = "Id";
// Optional. Apply when you need to edit data in the combobox.
cb.Editable = true;
cb.AttachTo(tree);
 
// handle the event to supply the combox items list.
tree.NodeComboBoxGetItems += tree_NodeComboBoxGetItems;</p>
<p>// add node.
NodeEx node = new NodeEx();
// default selected item`s index.
node.Id = 1;
node.AttachTo(tree);
 
private void tree_NodeComboBoxGetItems(FlexibleTreeView pTreeview, NodeComboBoxGetItemsEventArgs pArgs)
{
  // supply the combobox`s dropdown items list.
  pArgs.Items = new string[] { "First", "Second", "Third" };
}

To set the maximum items count in the drop–down portion of the combobox, use the MaxDropDownItems property.

Previous Top Next


Last news
Bookmark and Share
Use Flexible TreeView in WPF project
Sunday, 18 December 2011

Do you have a WPF project and want to use Flexible TreeView there? No problem!

Flexible TreeView v3.4
Friday, 16 December 2011

Flexible TreeView v3.4 maintenance release has been released.

Flexible TreeView v3.3
Friday, 23 September 2011

Flexible TreeView v3.3 maintenance release has been released. Separate assemblies for .NET 2.0, 4.0 and 4.0 Client Profile, HTML markup extension, etc.

Latest release

Version:
Release date:
3.4
Dec 16, 2011


Copyright © 2006-2012 ARMSoft. All rights reserved.