Back to Devexpress

ImageEditorAttribute Class

expressappframework-devexpress-dot-persistent-dot-base-cd64e29b.md

latest5.3 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class ImageEditorAttribute :
    ModelExportedValuesAttribute
vb
<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. 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:

NameDescription
ImageEditorAttribute.DetailViewImageEditorFixedHeightSpecifies the fixed height of Image Property Editors in Detail Views.
ImageEditorAttribute.DetailViewImageEditorFixedWidthSpecifies the fixed width of Image Property Editors in Detail Views.
ImageEditorAttribute.DetailViewImageEditorModeSpecifies how images represented by the target Image property must be displayed in WinForms Detail Views.
ImageEditorAttribute.ImageSizeModeSpecifies how images represented by the target Image property must be resized in WinForms Image Property Editor.
ImageEditorAttribute.ListViewImageEditorCustomHeightSpecifies the height of inplace Image Property Editors in List Views.
ImageEditorAttribute.ListViewImageEditorModeSpecifies how images represented by the target Image property must be displayed in WinForms 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:

  • All the Property Editors that represent the Photo property in Detail Views will have a fixed width of 40 pixels :

Inheritance

Object Attribute DevExpress.Persistent.Base.ModelExportedValuesAttribute ImageEditorAttribute

See Also

ImageEditorAttribute Members

DevExpress.Persistent.Base Namespace