Skip to main content

ImageCollection Class

The collection of Image objects to be used within DevExpress controls. The ImageCollection is also used as a part of the SharedImageCollection component.

Namespace: DevExpress.Utils

Assembly: DevExpress.Utils.v23.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core


public class ImageCollection :

The following members return ImageCollection objects:


Use the ImageCollection and SharedImageCollection components to store a set of images for various DevExpress WinForms controls. Such controls provide Images (or ImageList) property to which an image collection can be assigned. To address a certain image from the image collection assigned to a control, use the ImageIndex property of the control or its visual element.


The SharedImageCollection is an image collection that allows you to share images between controls within multiple forms in the same project. Images in the ImageCollection are the same size, while images in the SharedImageCollection can be different sizes.

Unlike the standard ImageList component, the ImageCollection and SharedImageCollection have certain advantages that include:

When images are loaded at design time from the DevExpress Image Gallery, an external assembly or project resources, binary data is not added to the project. Target images are referenced using specific identifiers and are loaded into memory dynamically, on demand.

At design time, the ImageCollection and SharedImageCollection components provide a customization menu available via the smart tag, which provides actions for customizing the image collection.


All images in the ImageCollection are the same size, specified by the ImageCollection.ImageSize property. When setting the ImageCollection.ImageSize property, the image collection is cleared. Thus, set this property prior to loading images to the ImageCollection. The loaded images can be accessed with the ImageCollection.Images property.

Load Images from External Assembly

You can load images from an external assembly to the ImageCollection or SharedImageCollection at design time, as follows.

  1. Create an assembly that will store images. Add images and set their Build Action properties to Embedded Resource.


  2. In your application project, add a reference to the image assembly.


  3. Add an image collection to a form (in this tutorial, the ImageCollection is used). Set the ImageCollection.ImageSize property to the required value.


  4. Click the ImageCollection‘s smart tag and select From Referenced Assemblies in the Load Images category.


  5. In the dialog that opens, select the images to load to the ImageCollection.


    The code that inserts the selected images to the ImageCollection is added to the form’s InitializeComponent method. The target images are referenced by the assembly name and the image relative paths. This approach allows you to modify images in the image assembly without the need to modify the application project.

    If an image library has changed while a project that references this library is opened, the changes may not be reflected by the opened Visual Studio instance. You may need to reload your application project for the changes to take effect.

Use Images from ImageCollection in Controls

The following steps demonstrate how you can assign images stored in an ImageCollection to buttons in a RibbonControl.

  1. Set the RibbonControl.LargeImages property to the created instance of the ImageCollection class. (Use the RibbonControl.Images property if images in the ImageCollection are small).


  2. Assign images to Ribbon Control buttons using the BarButtonItem.LargeImageIndex properties (or BarButtonItem.ImageIndex properties in case of small images). At design time, this can be accomplished using a button’s smart tag menu.


Known Issues

  • In Visual Studio 2012 and newer, if the ImageCollection imports images from an assembly and this assembly changes, Visual Studio caching prevents you from seeing these changes at design time. When this happens, rebuild the project and restart Visual Studio.
  • Due to a known Visual Studio bug, the ImageCollection updates the .resx file for the currently selected language only. Thus, if another localization is applied, the required image may not be found and the IndexOutOfRange exception may occur.


See Also