BaseView.HtmlImages Property
Gets or sets a collection of images that can be embedded in column/band headers, group rows and cells using the image tag.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
[DefaultValue(null)]
[DXCategory("Appearance")]
public virtual object HtmlImages { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Object | null | An image collection (DevExpress.Utils.ImageCollection or DevExpress.Utils.SvgImageCollection). |
Remarks
You can use a set of HTML-inspired tags to format text in column headers, band headers, group rows and cells.
The GridOptionsView.AllowHtmlDrawHeaders and GridOptionsView.AllowHtmlDrawGroups properties activate HTML formatting for column/band headers and group rows. To format cell text with HTML tags, use RepositoryItemHypertextLabel.
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 display images in cells with RepositoryItemHypertextLabel, you can also assign the created image collection to the RepositoryItemHypertextLabel.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 for more information.
Example
The following example shows how to display an image to the right of the Customer column’s caption using HTML tags. The HTML formatting feature is enabled via the GridOptionsView.AllowHtmlDrawHeaders property.
string imageName = "customer";
imageCollection1.AddImage(Image.FromFile("c:\\customer-16x16.png"), imageName);
gridView1.OptionsView.AllowHtmlDrawHeaders = true;
gridView1.HtmlImages = imageCollection1;
columnCustomer.Caption = columnCustomer.GetCaption() + "<image=" + imageName + ">";