c# - WPF in-memory image not rendering after assigned to Image.Source -


i've been searching hours find what's problem , can't find it. i'm using function convert base64string bitmapimage

public static bitmapimage base64stringtobitmapimage(string base64string) {         byte[] bytebuffer = convert.frombase64string(base64string);         memorystream memorystream = new memorystream(bytebuffer);         memorystream.position = 0;          bitmapimage bitmapimage = new bitmapimage();          using (memorystream) {             bitmapimage.begininit();             bitmapimage.cacheoption = bitmapcacheoption.onload;             bitmapimage.streamsource = memorystream;             bitmapimage.endinit();              bitmapimage.freeze();         }         memorystream.close();         memorystream = null;         bytebuffer = null;          return bitmapimage;     } 

and assign property of viewmodel bound view:

processimage = base64stringtobitmapimage(_imagestring); 

mainwindow.xaml

<image x:name="part_image" width="auto" height="auto" source="{binding processimage}" /> 

i've done test setting image background red , i've noticed image resized should (1920x1080 since printscreen computer), can't see rendered image... i've done many tests , searched on google , haven't found solutions... sees wrong code or have idea what's causing problem? i'm running out of options :(

i've found problem. after saving image on server side, i've discovered printscreen image wasn't correct. did few modification , worked fine.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -