Back to Devexpress

BaseImageListBoxControl.ImageMember Property

windowsforms-devexpress-dot-xtraeditors-dot-baseimagelistboxcontrol-77ae9a46.md

latest4.5 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue("")]
[DXCategory("Data")]
public virtual string ImageMember { get; set; }
vb
<DXCategory("Data")>
<DefaultValue("")>
Public Overridable Property ImageMember As String

Property Value

TypeDefaultDescription
StringString.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.

csharp
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;
vb
Dim dt As New DataTable()
Dim image As New DataColumn("Image", GetType(Image))
Dim caption As New DataColumn("Caption", GetType([String]))
Dim value As New DataColumn("Value", GetType(Int32))
dt.Columns.AddRange(New DataColumn() {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.

See Also

DataSource

DisplayMember

ValueMember

ImageMemberChanged

ImageList

ImageIndexMember

GlyphAlignment

BaseImageListBoxControl Class

BaseImageListBoxControl Members

DevExpress.XtraEditors Namespace