locked
Saving image and displaying saved image in list view. RRS feed

  • Question

  • Hello Everyone,

    I want to save some client data with its respective image. For storing image, I've converted bitmap image into byte array and stored that array in database but while displaying all records, I want to display respective image for particular client in list view.

    Please share if anyone has example.

    Thanks,

    Hitesh

    Thursday, June 18, 2015 8:34 PM

Answers

  • I've read this question three times.

    If you managed to write it away to the database then you know about database access and presumably can read data if you can write it.

    Let's say you have a Clients table with a row per client.

    Add your blob column to that.

    Read that with the rest of the client's data and translate it into a bitmap.

    Or maybe I've misunderstood what the issue is here.


    Hope that helps.

    Technet articles: WPF: Change Tracking; All my Technet Articles

    Saturday, June 20, 2015 10:11 AM

All replies

  • Hi Hitesh,

    You said particular client, is that mean there is a server and several clients? If so, you have to write a service to public some methods for clients to save or retrieve these image data. If it is not your scenario, say more.  

    Saturday, June 20, 2015 12:37 AM
  • I've read this question three times.

    If you managed to write it away to the database then you know about database access and presumably can read data if you can write it.

    Let's say you have a Clients table with a row per client.

    Add your blob column to that.

    Read that with the rest of the client's data and translate it into a bitmap.

    Or maybe I've misunderstood what the issue is here.


    Hope that helps.

    Technet articles: WPF: Change Tracking; All my Technet Articles

    Saturday, June 20, 2015 10:11 AM
  • Thank you so much Andy...it is working fine :)

    I've used following function to convert byte image array to bitmap.

            public async Task<BitmapImage> ConvertToBitmapImage(byte[] image)
            {
                var ims = new InMemoryRandomAccessStream();
                var dataWriter = new DataWriter(ims);
                dataWriter.WriteBytes(image);
                await dataWriter.StoreAsync();
                ims.Seek(0);
                var img = new BitmapImage();
                img.SetSource(ims);
                return img;
            }

    Thursday, July 2, 2015 6:16 AM