Version

We recommend that you use the xamComboEditor control instead of the xamComboEditor (Input) control. The xamComboEditor (Input) is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamComboEditor (Input) during this time. For help or questions on migrating your codebase to the xamComboEditor, please contact support.

Manually Add Items to xamComboEditor

Data binding plays a pivotal role in every data-presentation control, including the xamComboEditor™ control; however, there may be cases where you want to manually add items to a control without binding the control to data. A simple drop-down list that provides three choices, such as high, medium, and low may be a good candidate for this particular scenario. In order to satisfy this type of requirement, you can set the ItemsProvider property of xamComboEditor to an instance of a ComboBoxItemsProvider object. Then, you can add ComboBoxDataItem objects directly to ItemsProvider property of xamComboEditor. Just like any ItemsControl in Microsoft® Windows® Presentation Foundation, you must choose between setting the ItemsSource property and adding items directly to the Items collection; you cannot do both.

When you add ComboBoxDataItems to the Items collection, you need to set the DisplayText property and the Value property of ComboBoxDataItem object. These two properties determine the value that is displayed to the end user and the value that is stored internally. By default, xamComboEditor will store the value of the ComboBoxDataItem object as a string. If you want to store the value as a different data type, you will have to set the XamComboEditor’s ValueType property to the data type that you want to store.

The example code below demonstrates how to add ComboBoxDataItems to xamComboEditor.

In XAML:

...
<igEditors:XamComboEditor.ItemsProvider>
        <igEditors:ComboBoxItemsProvider>
                <igEditors:ComboBoxItemsProvider.Items>
                        <igEditors:ComboBoxDataItem DisplayText="Item 1" Value="Item 1" />
                        <igEditors:ComboBoxDataItem DisplayText="Item 2" Value="Item 2" />
                        <igEditors:ComboBoxDataItem DisplayText="Item 3" Value="Item 3"/>
                </igEditors:ComboBoxItemsProvider.Items>
        </igEditors:ComboBoxItemsProvider>
</igEditors:XamComboEditor.ItemsProvider>
...