The requested page is not available for the requested platform. You are viewing the content for Default platform.

ImageEditorAttribute Class

Applied to business class properties of the byte array type. Specifies that the target property persists an image. Attribute parameters specify settings to be used by Image Property Editors when displaying images persisted by the target property.

Namespace: DevExpress.Persistent.Base

Assembly: DevExpress.ExpressApp.v19.1.dll

Declaration

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class ImageEditorAttribute :
    ModelExportedValuesAttribute
<AttributeUsage(AttributeTargets.Property Or AttributeTargets.Field, Inherited:=True, AllowMultiple:=False)>
Public Class ImageEditorAttribute
    Inherits ModelExportedValuesAttribute

Remarks

By default, byte[] properties are displayed via Default Property Editor as a collection of bytes. If the ImageEditorAttribute attribute is applied, Image Property Editors are used. The ImagePropertyEditor is used in XAF Windows Forms applications, the ASPxImagePropertyEditor is used in XAF ASP.NET Web applications. These Property Editors are instantiated using default settings when the ImageEditorAttribute attribute is applied without parameters. However, it is often necessary to specify different settings for the Property Editors that display images represented by different properties. To do this, pass the settings as the parameters. This will make all the Image Property Editors use the specified settings when displaying images.

Basically, there are two groups of settings - the settings that affect the Image Property Editors used in Detail Views and the settings that affect the inplace Image Property Editors used in List Views. The following table lists the ImageEditorAttribute class' public properties that can be passed as named parameters in the attribute's constructor:

Name Description
ImageEditorAttribute.DetailViewImageEditorFixedHeight Specifies the fixed height of Image Property Editors in Detail Views.
ImageEditorAttribute.DetailViewImageEditorFixedWidth Specifies the fixed width of Image Property Editors in Detail Views.
ImageEditorAttribute.DetailViewImageEditorMode Specifies how images represented by the target Image property must be displayed in Detail Views.
ImageEditorAttribute.ImageSizeMode Specifies how images represented by the target Image property must be resized in Image Property Editors.
ImageEditorAttribute.ListViewImageEditorCustomHeight Specifies the height of inplace Image Property Editors in List Views.
ImageEditorAttribute.ListViewImageEditorMode Specifies how images represented by the target Image property must be displayed in List Views.

These parameters have the corresponding properties in the Application Model's IModelMember node. When the ImageEditorAttribute is applied to a property, the parameter's values are assigned to the Application Model's property of the node that represents the target property. These Application Model properties values, in turn, are set to the relative properties of the IModelColumn and IModelPropertyEditor nodes that also correspond to the target property.

The following code snippets demonstrate the ImageEditorAttribute usage.

  • All the Property Editors that represent the Photo property will display images in drop-down windows:

    using System.Drawing;
    using DevExpress.Persistent.Base;
    
    //...
    
    public class Contact : Person {
    //...
    
        [ImageEditor(ListViewImageEditorMode = ImageEditorMode.DropDownPictureEdit, 
            DetailViewImageEditorMode = ImageEditorMode.DropDownPictureEdit)]
        public byte[] Photo {
            get { return GetPropertyValue<byte[]>("Photo"); }
            set { SetPropertyValue<byte[]>("Photo", value); }
        }
    
    //...
    }
    
  • All the Property Editors that represent the Photo property in Detail Views will have a fixed width of 40 pixels :

    using System.Drawing;
    using DevExpress.Persistent.Base;
    //...
    public class Contact : Person {
    //...
    
        [ImageEditor(DetailViewImageEditorMode = ImageEditorMode.PictureEdit, 
            DetailViewImageEditorFixedWidth = 40)]
        public byte[] Photo {
            get { return GetPropertyValue<byte[]>("Photo"); }
            set { SetPropertyValue<byte[]>("Photo", value); }
        }
    //...
    }
    

Inheritance

Object
Attribute
DevExpress.Persistent.Base.ModelExportedValuesAttribute
ImageEditorAttribute

Implements

See Also