Wednesday, 15 August 2012

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


I've been searching for hours to find out what the problem is and can not find it. I have been using this function to convert a base64String to a BitmapImage

  public static BitmapImage Base64StringToBitmapImage (string base64String) {byte [] ByteBuffer = Convert.FromBase64String (base64String); Memorystream memorystream = new memorystream (bytefuffer); MemoryStream.Position = 0; Bitmap image bitmap image = new bitmap image (); (Memorystream) {bitmapImage.BeginInit (); BitmapImage.CacheOption = BitmapUp Download; BitmapImage.StreamSource = memoryStream; BitmapImage.EndInit (); BitmapImage.Freeze (); } MemoryStream.Close (); MemoryStream = null; Bytebuff = Faucet; Return bitmap image; }  

And then assign to a view of my ViewModel that is bound to a sequence:

  ProcessImage = Base64StringToBitmapImage (_imageString);  

MainWindow.xaml

  & lt; Image X: Name = "PART_IMAGE" width = "Auto" height = "Auto" source = "{Binding ProcessImage}" />  

Tested and I see image rendered from image (1920x1080 since its one printscreen from my computer), but I can find it can be perfectly shaped ... I have done many tests and searched all over Google And no solution is found ... Anything wrong with this code Looks or is an idea that is causing the problem? I'm actually running out of options: after the text "itemprop =" text ">

I found the problem after saving the image.


No comments:

Post a Comment