Version

Set an Embeddable Editor

Starting with Version 3 of the WinTree™, the functionality for editing tree nodes has been significantly enhanced. Tree node editing is now handled by the Embeddable Editor technology of the Infragistics.Win assembly. With embeddable editors, you can choose the editing interface that will be presented to the user when they edit a node. The default setting is to display a text editor, but you can use a masked numeric editor, a currency editor, a combo box editor, or any of several others. For a complete overview of using embeddable editors with WinTree, see the Embeddable Editors Overview.

You enable the use of embeddable editors by setting the UseEditor property to True. This property is located on the Override object, so it can be set at the tree level and set or overridden at several sub-levels: for all the nodes in a particular Nodes collection, for all the nodes at a specified level of the tree hierarchy, or for an individual node. The default setting for this property is True.

The control will default to using a simple text editor when editing the text of a node. To change the embeddable editor used, set the Editor or EditorComponent property of the Override object. This property can be set at the tree level and set or overridden at several sub-levels: for all the nodes in a particular Nodes collection, for all the nodes at a specified level of the tree hierarchy, or for an individual node. Use the EditorComponent property if you have a stand-alone editor control on your form that you want to serve as the embedded editor. Typically this will be an WinEditors control, but it can be another control that implements the IProvidesEmbeddableEditor interface. Use the Editor property if you will be creating an instance of the embedded editor through code at run-time. Note that the setting of the Editor property always supersedes the setting of the EditorComponent property.

The following code illustrates how to set a specific embeddable editor for all nodes in the tree, then override the setting for nodes in a single level of the tree’s hierarchy.

In Visual Basic:

Imports Infragistics.Win
...
Private Sub Set_an_Embeddable_Editor_Load(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) Handles MyBase.Load
	Me.UltraTree1.Override.LabelEdit = DefaultableBoolean.True
	Me.UltraTree1.Override.Editor = New EditorWithMask()
	' All nodes at the third level of the hierarchy
	' (root node grandchildren) will use ColorPicker
	Me.UltraTree1.NodeLevelOverrides(2).Editor = New ColorPickerEditor()
End Sub

In C#:

using Infragistics.Win;
...
private void Set_an_Embeddable_Editor_Load(object sender, EventArgs e)
{
	this.ultraTree1.Override.LabelEdit = DefaultableBoolean.True;
	this.ultraTree1.Override.Editor = new EditorWithMask();
	// All nodes at the third level of the hierarchy
	// (root node grandchildren) will use ColorPicker
	this.ultraTree1.NodeLevelOverrides[2].Editor = new ColorPickerEditor();
}