Skip to main content
A newer version of this page is available. .

GalleryControl Class

The control displaying an image gallery, with the capability to categorize items into groups.

Namespace: DevExpress.XtraBars.Ribbon

Assembly: DevExpress.XtraBars.v19.1.dll


[ToolboxBitmap(typeof(ToolboxIconsRootNS), "GalleryControl")]
public class GalleryControl :

The following members return GalleryControl objects:


GalleryControl allows you to implement an image gallery, where each item (GalleryItem) is an image. Items can have captions and they can be combined into groups (GalleryItemGroup), if required.

Below is a sample GalleryControl that displays a set of images categorized into two groups (Cars and People):


Online Video

The Gallery Control

GalleryControl is one of the DevExpress controls that provide the gallery functionality. General information on galleries, items and gallery initialization can be found in the following topics:

The control’s gallery can be accessed with the GalleryControl.Gallery property, which is of the GalleryControlGallery class (a BaseGallery descendant). To initialize a gallery, first add gallery groups to the BaseGallery.Groups collection. Then, add gallery items to each group using the GalleryItemGroup.Items collection.

Features common to all DevExpress gallery controls are covered in the Gallery Controls topic. Below is a list of additional features supported by the GalleryControl.


This example shows how to create a GalleryControl with two groups (Cars and People), and add images to these groups:


using DevExpress.XtraBars.Ribbon;
using DevExpress.Utils;
using DevExpress.Utils.Drawing;

GalleryControl gc = new GalleryControl();
gc.Dock = DockStyle.Fill;

Image im1 = Image.FromFile("c:\\Images\\BMW.jpg");
Image im2 = Image.FromFile("c:\\Images\\Ford.jpg");
Image im3 = Image.FromFile("c:\\Images\\MercedecBenz.jpg");
Image im4 = Image.FromFile("c:\\Images\\AnneDodsworth.jpg");
Image im5 = Image.FromFile("c:\\Images\\HannaMoos.jpg");
Image im6 = Image.FromFile("c:\\Images\\JanetLeverling.jpg");

gc.Gallery.ItemImageLayout = ImageLayoutMode.ZoomInside;
gc.Gallery.ImageSize = new Size(120, 90);
gc.Gallery.ShowItemText = true;

GalleryItemGroup group1 = new GalleryItemGroup();
group1.Caption = "Cars";

GalleryItemGroup group2 = new GalleryItemGroup();
group2.Caption = "People";

group1.Items.Add(new GalleryItem(im1, "BMW", ""));
group1.Items.Add(new GalleryItem(im2, "Ford", ""));
group1.Items.Add(new GalleryItem(im3, "Mercedec-Benz", ""));

group2.Items.Add(new GalleryItem(im4, "Anne Dodsworth", ""));
group2.Items.Add(new GalleryItem(im5, "Hanna Moos", ""));
group2.Items.Add(new GalleryItem(im6, "Janet Leverling", ""));
See Also