BaseImageListBoxControl.ImageMember Property
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.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
String | String.Empty | A string value specifying the name of the data source field whose contents represent images. |
Remarks
The ImageListBoxControl can be bound to data using the BaseListBoxControl.DataSource property. Use ImageMember to define the data source field that provides the images displayed within the items. See an example below.
DataTable dt = new DataTable();
DataColumn image = new DataColumn("Image", typeof(Image));
DataColumn caption = new DataColumn("Caption", typeof(String));
DataColumn value = new DataColumn("Value", typeof(Int32));
dt.Columns.AddRange(new[] { image, caption, value });
dt.Rows.Add(new object[] { new Bitmap("D:////Image0.bmp"), "Hello", 0 });
dt.Rows.Add(new object[] { new Bitmap("D:////Image1.bmp"), "World", 1 });
imageListBoxControl1.ValueMember = "Value";
imageListBoxControl1.DisplayMember = "Caption";
imageListBoxControl1.ImageMember = "Image";
imageListBoxControl1.DataSource = dt;
Changing the ImageMember property value at runtime raises the BaseImageListBoxControl.ImageMemberChanged event.
You can also use the BaseImageListBoxControl.ImageList property to provide a collection of images, and the BaseImageListBoxControl.ImageIndexMember property to specify the name of the data field that contains indexes of the required images in the collection. ImageMember has priority over BaseImageListBoxControl.ImageIndexMember.