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?
2 回答
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.
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).