Nevron Open Vision Documentation
Combo Box

The combo box is a drop down edit, which displays a drop down list of items to choose from.


The most commonly used properties of a combo box are:


The most commonly used events of a combo box are:


The NComboBox class provides the following useful public methods:

Code Example

The following example demonstrates how to create a simple combo box with 3 items and how to handle its SelectedIndexChanged event:

Combo Box Example
Copy Code
NComboBox comboBox = new NComboBox();
comboBox.Items.Add(new NComboBoxItem("Item 1"));
comboBox.Items.Add(new NComboBoxItem("Item 2"));
comboBox.Items.Add(new NComboBoxItem("Item 3"));
comboBox.SelectedIndex = comboBox.IndexOfItemWithText("Item 2", StringComparison.Ordinal);
comboBox.SelectedIndexChanged += new Function<NValueChangeEventArgs>(OnComboBoxSelectedIndexChanged);

private void OnComboBoxSelectedIndexChanged(NValueChangeEventArgs arg1)
    // Get the new selected index
    int selectedIndex = (int)arg1.NewValue;

    // Get the combo box, whose index has changed
    NComboBox comboBox = (NComboBox)arg1.CurrentTargetNode;

The combo box item’s content can be any widget, so it’s easy to create whatever combo box item you wish. For example, to create a combo box item that has image and text just put the image and the text in a pair box and assign it as content of the combo box item:

Combo Box Item with Image and Text
Copy Code
NImage image = new NImage(new NUri(@"C:\MyImage.png"));
NPairBox pairBox = new NPairBox(image, "Item 1");
NComboBoxItem item = new NComboBoxItem(pairBox));

// When using custom widgets for combo box item content, don't forget to set item's text
// if you want to take advantage of the IndexOfItemWithText method of the combo box
item.Text = "Item 1";
Send Feedback