0

I want to make application which will load images from web and display it on a TabControl. First panel displays sourc of page (I've done this). On the second panel it should display images from current webpage and some buttons (For example "save this image"). Im getting every url for images, but i don't know how to display them on the second tab item with some buttons. What is the best solution for that?

Lucas
  • 3,376
  • 6
  • 31
  • 46
Piotr Łużecki
  • 1,031
  • 4
  • 17
  • 33
  • 1
    See: http://stackoverflow.com/a/3148290/1341477 – Dave Williams Jun 28 '13 at 14:06
  • But in here i can change source of existing image. I would like to add many images and buttons programmatically. – Piotr Łużecki Jun 28 '13 at 14:19
  • 1
    Yeah, but the point is you will need to download them all before you can show them (at least as I understand) so just getting the URL is only step 1. you need to then download each image and after that you can show them in several ways one of which would be ItemsControl as suggested by Lucas. – Dave Williams Jun 28 '13 at 14:33

2 Answers2

3

I'm not sure what you trying to achieve but I guess you should use ItemsControl.

You can set a ItemsSource which you update programmatically.

Lucas
  • 3,376
  • 6
  • 31
  • 46
1

You can either read the images into memory (as in the link I put in my comment) or download them all and add a reference to the path for each one.

You can then bind the source of a control e.g ItemsControl to a collection (e.g Observable Collection) and provide a template which will show the image, text, and button you desire.

You can search yourself for the multitude of examples on ItemsControls, templates etc but here is a starter:

SDK Example which is quite good for you to start with.

One from Josh Smith which is quite popular.

Another Stack Overflow Question with similar requirements.

And an example I found on google

If I were you I would also look into using multithreading to fetch and display the images. This way (whether it is in memory or downloaded files) it will get the image and add it to your collection in another thread, which will enable the UI to be updated as each image is obtained rather than in one lump at the end (quite likely after a long wait).

Community
  • 1
  • 1
Dave Williams
  • 2,166
  • 19
  • 25