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.
Bind xamComboEditor to an XmlDataProvider
You can bind xamComboEditor™ to several different data sources, including an XML file. You can use an XmlDataProvider to expose your XML file to the presentation layer of your application. If you have not created an XmlDataProvider yet, please read and follow the steps on creating an XmlDataProvider before proceeding with the rest of this topic.
The xamComboEditor control does not bind directly to a data source; instead, xamComboEditor uses an instance of a ComboBoxItemsProvider object to bind to data. You can data bind the ComboBoxItemsProvider object using the same patterns you would use for any Microsoft® Windows® Presentation Foundation ItemsControl. You can set the ItemsSource property to a binding expression that references an XmlDataProvider to populate the drop-down list.
The default behavior of an ItemsControl is to display the results of the ToString method of the underlying object. You can override this default behavior either by creating a DataTemplate that determines the visual tree of each item or by setting the DisplayMemberPath and ValuePath properties that the ComboBoxItemsProvider object conveniently provide. You can set the DisplayMemberPath property to the name of a property on your business object that you want to display to the end user. You can set the ValuePath property to the name of a property on your business object that you want to store as the underlying value of xamComboEditor. The data type that xamComboEditor is editing must match the data type of the property that you specify as the ValueType property of the xamComboEditor. For example, if you set the ValuePath property of a ComboBoxItemsProvider object to a property that returns an integer, you should also set the ValueType property of xamComboEditor to an integer data type.
The following example code demonstrates how to bind xamComboEditor to an XmlDataProvider.
...
<!--Notice that the ValueType property is set to the same data type as the property specified for the ValuePath property.
The sys: prefix is mapped to the XML namespace 'clr-namespace:System;assembly=mscorlib'-->
<igEditors:XamComboEditor ValueType="{x:Type sys:Int32}" VerticalAlignment="Top">
<igEditors:XamComboEditor.ItemsProvider>
<igEditors:ComboBoxItemsProvider
ItemsSource="{Binding Source={StaticResource OrderData},
XPath=/Orders/Order}"
DisplayMemberPath="ProductName" ValuePath="Quantity" />
</igEditors:XamComboEditor.ItemsProvider>
</igEditors:XamComboEditor>
...