NodeComboBoxString

The NodeComboBoxString, in contrast to NodeComboBox and NodeComboBoxEnum, allows binding to a string data property and selecting its value from a list of dropdown items.

It supports the same features as NodeComboBox, such as DropDownItems, InteractiveDropDownItems, and MaxDropDownItems, etc.

To bind NodeComboBoxString, you need:

  1. Define a string data property in the node class:

    Example

    class CustomerNode : Node
    {
        public string PreferedLanguage { get; set; }
    }
    
    Class CustomerNode
        Inherits Node
    
        Public Property PreferedLanguage As String
    End Class
    
  2. Create a NodeComboBoxString instance, specify its dropdown list of available values to select, and bind it to the added data property.

    For testing purposes, we create the node control manually in code below, but it could also be created in Visual Studio Windows Forms form's designer at design-time.

    Example

    NodeComboBoxString ctrl = new NodeComboBoxString();
    ctrl.DataFieldName = "PreferedLanguage";
    ctrl.DropDownItems = new[] { "English", "Español", "Français", "Deutsch" };
    ctrl.Editable = true;
    ctrl.EditStartMode = eEditStartMode.Click; // optional
    ctrl.AttachTo(tree);
    
    Dim ctrl As New NodeComboBoxString()
    ctrl.DataFieldName = "PreferedLanguage"
    ctrl.DropDownItems = New () {"English", "Español", "Français", "Deutsch"}
    ctrl.Editable = True
    ctrl.EditStartMode = eEditStartMode.Click  ' optional
    ctrl.AttachTo(tree)
    

After running the above code and changing the displayed 'English' value by selecting a new one from the dropdown, the PreferedLanguage property of the selected node instance will be updated accordingly.