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.v18.1.dll

Declaration

[ToolboxTabName("DX.18.1: Navigation & Layout")]
[ToolboxBitmap(typeof(ToolboxIconsRootNS), "GalleryControl")]
public class GalleryControl :
    BaseStyleControl,
    IBarAndDockingControllerClient,
    ISupportInitialize,
    IToolTipControlClient,
    IMouseWheelSupport,
    IGestureClient

The following members accept/return GalleryControl objects:

Remarks

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):

GalleryControl

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.

Example

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

GalleryControl_ex

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

GalleryControl gc = new GalleryControl();
gc.Dock = DockStyle.Fill;
this.Controls.Add(gc);

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";
gc.Gallery.Groups.Add(group1);

GalleryItemGroup group2 = new GalleryItemGroup();
group2.Caption = "People";
gc.Gallery.Groups.Add(group2);

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", ""));

The following code snippets (auto-collected from DevExpress Examples) contain references to the GalleryControl class.

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.

See Also