Results 1 to 1 of 1

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    South Africa

    How to Convert Byte Array to BitmapSource in C# for Silverlight

    Good Day All

    I have a Generic function that in my Static Class. i have this Class in Silverlight
        public static BitmapSource LoadImage(Byte[] imageBytes)
                BitmapImage bmpImage = new BitmapImage();
                MemoryStream mystream = new MemoryStream(imageBytes);
                return bmpImage;
    Now this looked fine for me until i had to bind an Image in Silverlight like this

    PhotoHolder.Source =GenericMethods.LoadImage(model.imbPhoto);

    The Images i have in the Database are Supported by silverlight they are jpg type.

    and the Elelment that i am binding to look like this in Silverlight

       <Image x:Name="PhotoHolder" Height="98" Width="102" OpacityMask="Black"  Canvas.Left="141" Canvas.Top="30">
    so if i bind i get this Error

    Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

    Last edited by vuyiswamb; May 26th, 2011 at 05:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width