ImageEditorOptions.PredefinedImages Property
A collection of images that an end user can load to the image editor in Print Preview.
Namespace: DevExpress.Xpf.Printing
Assembly: DevExpress.Xpf.Printing.v24.2.dll
NuGet Package: DevExpress.Wpf.Printing
Declaration
Property Value
Type | Description |
---|---|
ICollection<ImageGalleryItem> | The image editor’s image collection. |
Property Paths
You can access this nested property as listed below:
Object Type | Path to PredefinedImages |
---|---|
ImageInplaceEditorInfo |
|
Remarks
Specify the PredefinedImages property to add the item to the image editor’s menu. This item allows end users to choose one of the predefined images and load it to the editor.
The following code snippet demonstrates how you can specify the PredefinedImages property.
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");
Do not specify image display names or set the AllowSearchPredefinedImages property to false if search within the image collection is not required.
If you want to allow end users to only choose an image in the predefined collection, you can use the RegisterImageCollectionEditorInfo method instead of the RegisterImageEditorInfo(String, ImageEditorOptions, String) method. The RegisterImageCollectionEditorInfo method takes an image collection directly, as a parameter.