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.

Properties and Events

The combo box provides the following properties:

Methods

The NComboBox class provides two groups of 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 = 0;
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));
Send Feedback