Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

LayoutViewColumn.ImageIndex Property

Gets or sets the index of an image in the ColumnView.Images collection that will be displayed within the field’s caption.

Namespace: DevExpress.XtraGrid.Columns

Assembly: DevExpress.XtraGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

#Declaration

[DefaultValue(-1)]
[XtraSerializableProperty]
public override int ImageIndex { get; set; }

#Property Value

Type Default Description
Int32 -1

An integer value that specifies the index of an image in the ColumnView.Images collection.

#Remarks

To display an image within a field’s caption, you can assign a collection of images to the ColumnView.Images property, and then associate the required image from this collection with the field via the ImageIndex or LayoutViewField.ImageIndex property (these properties are in sync). The LayoutViewColumn.LayoutViewField object provides options to control the image’s alignment and the distance between the image and the field caption.

An image can also be displayed within a field caption by assigning it to the LayoutViewColumn.Image property. If images are specified via both the ImageIndex and Image properties, the image assigned to the Image property will be used.

To dynamically assign images to fields (for instance, depending on a card’s or field’s state), use the LayoutView.CustomFieldCaptionImage event.

Tip

You can also assign an image by its name in the collection.

// The image collection is created and populated with images at design time.
barItem.ImageOptions.Image = imageCollection1["technology_32x32"]; 
// Assign an SVG image in the SvgCollection
// barItem.ImageOptions.SvgImage = svgCollection1["technology_32x32"];

Read the following help topic for more information: Access and Use DevExpress Icons in Code.

See Also