ItemsSource Property (XamComboEditor)

Specifies the collection from which to populate the drop-down of this XamComboEditor. This property providers an alternate way of specifying ItemsProvider.
Public Property ItemsSource As IEnumerable
public IEnumerable ItemsSource {get; set;}

There are two ways you can specify the items to display in the drop-down of the XamComboEditor. By assigning ItemsProvider property to an instance of ComboBoxItemsProvider or by assigning ItemsSource property.

Using ItemsProvider is more efficient when you need to bind the same items source to multiple XamComboEditors, in which case you would assign the same ComboBoxItemsProvider instance to multiple XamComboEditors. For example, if you have a two or more XamComboEditors on the form displaying the same drop-down list of items. Or inside a DataGrid field where cells are using XamComboEditors that all bind to the same items source. It is more efficient because a single ComboBoxItemsProvider manages binding to underlying data source items collection and all the associated XamComboEditors make use of that single instance.

If however situation doesn't call for multiple instances of the editor using the same data source, ItemsSource property offers a more convenient way of specifying the drop-down list items where you don't have to create an instance of ComboBoxItemsProvider. Although creating ComboBoxItemsProvider is a very simple procedure, in certain situations using ItemsSource can be more convenient, especially in XAML where binding is involved. As a note, when you set ItemsSource property, internally the XamComboEditor simply creates a ComboBoxItemsProvider that wraps the specified items source and sets the ItemsProvider to it.

NOTE: ItemsSource and ItemsProvider are exclusive. Use one or the other. Setting ItemsProvider and then setting ItemsSource will ignore the ItemsSource.


Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also