Skip to main content
A newer version of this page is available. .

BaseListBoxControl.HtmlImages Property

Gets or sets a collection of images to be inserted into the display text of the control’s items. This property is in effect when using the HTML formatting feature.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v18.2.dll

Declaration

[DefaultValue(null)]
[DXCategory("Appearance")]
public ImageCollection HtmlImages { get; set; }

Property Value

Type Default Description
ImageCollection *null*

A ImageCollection object that stores a collection of images.

Remarks

The HTML formatting feature, which is activated via the BaseListBoxControl.AllowHtmlDraw property, allows you to format the display text of the control’s items using a set of HTML tags. The image tag can be used to insert an image from an ImageCollection or from the project’s resources into the display text.

If you want to insert an image from an ImageCollection, create a ImageCollection object, add images to it and then assign this ImageCollection to the HtmlImages property. All images in the ImageCollection have names. Use these names to refer to specific images while using the image tag. See HTML Text Formatting to learn more.

Example

The following code shows how to create items for a ListBoxControl and format the items’ display text using HTML tags. The image HTML tag is used to insert an image into an item’s text from an ImageCollection, assigned to the BaseListBoxControl.HtmlImages property. The HTML formatting feature is activated via the BaseListBoxControl.AllowHtmlDraw feature.

ListBoxControl-HtmlImages-ex

listBoxControl1.ItemHeight = 20;
listBoxControl1.HtmlImages = imageCollection1;
listBoxControl1.AllowHtmlDraw = DefaultBoolean.True;
for (int i = 0; i < imageCollection1.Images.Count; i++) {
    string item = String.Format("id: {0} - <image={1}>", i, imageCollection1.Images.InnerImages[i].Name);
    listBoxControl1.Items.Add(item);
}
See Also