Back to Devexpress

BarItemImageOptions.ImageIndex Property

windowsforms-devexpress-dot-xtrabars-dot-baritemimageoptions-fbb49845.md

latest4.2 KB
Original Source

BarItemImageOptions.ImageIndex Property

Gets or sets the index of a small glyph assigned to this BarItem.

Namespace : DevExpress.XtraBars

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(-1)]
[DXCategory("Appearance")]
[ImageList("Images")]
public override int ImageIndex { get; set; }
vb
<DefaultValue(-1)>
<DXCategory("Appearance")>
<ImageList("Images")>
Public Overrides Property ImageIndex As Integer

Property Value

TypeDefaultDescription
Int32-1

The index of an image in the collection of small images.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ImageIndex
BarButtonItem

.ImageOptions .ImageIndex

| | BarItem |

.ImageOptions .ImageIndex

| | BarItemLink |

.ImageOptions .ImageIndex

|

Remarks

For details, see the BarItem.ImageOptions.ImageIndex property, which is equivalent to the current setting.

Tip

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

csharp
// 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"];
vb
' 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.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ImageIndex property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-assign-popupmenu-to-dropdownbutton/CS/DropDownButtonExample/Form1.cs#L30

csharp
item.Id = this.barManager1.GetNewItemId();
item.ImageOptions.ImageIndex = imageIndex;
item.Name = name;

winforms-assign-popupmenu-to-dropdownbutton/VB/DropDownButtonExample/Form1.vb#L31

vb
item.Id = barManager1.GetNewItemId()
item.ImageOptions.ImageIndex = imageIndex
item.Name = name

See Also

ImageIndex

BarItemImageOptions Class

BarItemImageOptions Members

DevExpress.XtraBars Namespace