Current filter:
                                You should refresh the page.
                                  • In v14.2, Image Property Editors (both WinForms and ASP.NET) support images saved as byte array objects (in addition to previously supported System.Drawing.Image objects). This allows us to significantly decrease web server memory consumption because the byte array can contain an image in a compressed format and the server does not have to unpack it. The previous approach with the Image type property is still supported, but we recommend that you migrate to the byte array storage to improve performance.

                                    Entity Framework
                                    If you use Entity Framework, you already have a byte array property mapped to data and hidden in UI. Unhide it and apply the ImageEditor attribute. Then, remove the auxiliary Image property that was used to display an image in UI. Optionally, you can apply the XafDisplayName attribute to fix the caption.

                                    Old code:

                                    [C#]
                                    private Image photo; [Browsable(false)] public Byte[] PhotoData { get; protected set; } [NotMapped] public Image Photo { get { if ((photo == null) && (PhotoData != null)) { ImageConverter imageConverter = new ImageConverter(); photo = (Image)imageConverter.ConvertFrom(PhotoData); } return photo; } set { photo = value; if (photo == null) PhotoData = null; else { ImageConverter imageConverter = new ImageConverter(); PhotoData = (Byte[])imageConverter.ConvertTo(photo, typeof(Byte[])); } } }

                                    New code:

                                    [C#]
                                    [ImageEditor, XafDisplayName("Photo")] public Byte[] PhotoData { get; set; }

                                    XPO
                                    To use the image property editor with images represented by the byte array, you need to change an image property type from System.Drawing.Image to byte[] , remove ImageValueConverter and ensure that ImageEditor is applied.

                                    Old code:

                                    [C#]
                                    [Size(SizeAttribute.Unlimited), ValueConverter(typeof(ImageValueConverter))] public Image Photo{ get { return GetPropertyValue<Image>("Photo"); } set { SetPropertyValue<Image>("Photo", value); } }

                                    New code:

                                    [C#]
                                    [Size(SizeAttribute.Unlimited), ImageEditor] public byte[] Photo { get { return GetPropertyValue<byte[]>("Photo"); } set { SetPropertyValue<byte[]>("Photo", value); } }

                                0 Solutions

                                Creation Date Importance Sort by