Created
October 16, 2021 19:04
-
-
Save alandalegend/4547c8aece1db70483cdd9279af9456d to your computer and use it in GitHub Desktop.
XAF convert Base64 and preview byte[]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***Guarda tu imagen en formato base64, y el DevExpress te mostrará la vista previa.***/ | |
private string base64; | |
[VisibleInDetailView(false), VisibleInListView(false), VisibleInLookupListView(false)] | |
[Size(SizeAttribute.Unlimited)] | |
public string Base64 | |
{ | |
get { return base64; } | |
set { SetPropertyValue("Base64", ref base64, value); } | |
} | |
private byte[] imagen; | |
[Persistent("Imagen")] | |
[XafDisplayName("Fotografía Oficial")] | |
[ImageEditor(ListViewImageEditorMode = ImageEditorMode.PictureEdit, DetailViewImageEditorMode = ImageEditorMode.PictureEdit, ListViewImageEditorCustomHeight = 40)] | |
public byte[] Imagen | |
{ | |
get | |
{ | |
if (!String.IsNullOrEmpty(Base64)) | |
{ | |
try | |
{ | |
string base6 = Base64; | |
base6 = base6.Replace("data:image/jpeg;base64,", ""); | |
imagen = System.Convert.FromBase64String(base6); | |
} | |
catch { imagen = null; } | |
} | |
return imagen; | |
} | |
set | |
{ | |
value = imagen; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment