BaseListBoxControl.DataSource Property
Gets or sets the data source that provides items to display in the control.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v19.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Object | *null* | A data source object whose data is displayed by the ListBox control. |
Remarks
Use the DataSource property to bind the control to a data source and thus display data source records as listbox items. The data source can be any object implementing the IList or IListSource interface. Changing the DataSource property value at runtime raises the BaseListBoxControl.DataSourceChanged event.
The following properties can be additionally customized:
- BaseListBoxControl.ValueMember - Gets or sets the field name in the bound data source whose contents are assigned to item values.
- BaseListBoxControl.DisplayMember - Gets or sets the name of the data source field that provides display text for listbox items. This property is not supported when listbox items are rendered based on Item Templates
- CheckedListBoxControl: BaseCheckedListBoxControl.CheckMember - Gets or sets the name of the data source field that provides check states for listbox items.
- ImageListBoxControl: BaseImageListBoxControl.ImageMember - Gets or sets the name of the data source field that provides images for listbox items. This property is not supported when listbox items are rendered based on Item Templates.
- ImageListBoxControl: BaseImageListBoxControl.ImageIndexMember - Gets or sets the name of the data source field that provides image indexes for listbox items. This property is not supported when listbox items are rendered based on Item Templates.
To retrieve listbox items in bound mode, use the BaseListBoxControl.GetItem method.
To populate the ListBox control in unbound mode, add items to the control’s Items collection (ListBoxControl.Items, BaseCheckedListBoxControl.Items or BaseImageListBoxControl.Items).
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the DataSource property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.