Skip to main content
All docs
V26.1
  • ImageGalleryItem Class

    An object that provides an image and its display name.

    Namespace: DevExpress.Xpf.Printing

    Assembly: DevExpress.Xpf.Printing.v26.1.dll

    NuGet Package: DevExpress.Wpf.Printing

    Declaration

    public class ImageGalleryItem :
        ImmutableObject

    Remarks

    When you register a custom image editor (see RegisterImageEditorInfo(String, ImageEditorOptions, String)) to edit the XRPictureBox‘s content in Print Preview, you can specify the PredefinedImages image collection. This collection is displayed in the image editor and enables end users to select one of the predefined images.

    Predefined Images

    Create the ImageGalleryItem objects to populate the PredefinedImages image collection. Specify the Image and DisplayName (optionally) properties for each item.

    The following code snippet demonstrates how you can specify the PredefinedImages collection.

    using System.Collections.Generic;
    using System.IO;
    using DevExpress.Xpf.Printing;
    using System.Drawing;
    
    //...
    
    Dictionary<string, Image> images = new Dictionary<string, Image>();
    foreach (var file in Directory.GetFiles("Images/Flags", "*.png")) {
        Image img = Image.FromFile(file);
        if (img != null) {
            string imageName = Path.GetFileNameWithoutExtension(file);
            images.Add(imageName, img);
        }
    };
    ImageEditorOptions imageEditorOptions = new ImageEditorOptions() {
        AllowLoadImage = false,
        AllowChangeSizeOptions = false,
        AllowDraw = false,
        AllowClear = true
    };
    foreach (var image in images)
        imageEditorOptions.PredefinedImages.Add(new ImageGalleryItem(image.Value, image.Key));
    EditingFieldExtensions.Instance.RegisterImageEditorInfo("Nationality", imageEditorOptions, "Nationality");
    

    Note

    If you do not set display names for all Image Gallery Items, search is not available in the image editor’s predefined collection.

    Inheritance

    Object
    DevExpress.Utils.ImmutableObject
    ImageGalleryItem
    See Also