Skip to main content

BaseListBoxControl.HtmlImages Property

Gets or sets a collection of images that can be inserted into item captions using the image tag.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.dll

Declaration

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

Property Value

Type Default Description
Object null

An image collection (DevExpress.Utils.ImageCollection or DevExpress.Utils.SvgImageCollection).

Remarks

Enable the BaseListBoxControl.AllowHtmlDraw property to use a set of HTML-inspired tags to format the display text of the control’s items.

When you compose an HTML string, you can use the image tag to insert an image from an image collection and project’s resources into the text.

To insert an image from an image collection, do the following:

  • Create an image collection (ImageCollection or SvgImageCollection) and populate it with images.
  • Assign the collection to the HtmlImages property.
  • When you use the image tag, address a target image by its name (image names can be obtained from the image collection).

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