jeudi 5 novembre 2015

Set a name for each ImageSource in a list. WindowsPhone 8.1

Vote count: 0

I call an API and get from there an id, a name and an URL for images...

I display them in a flipview and I used to convert them, saved them in a folder, convert them back and show them...

So I thought it would be much easier if I show them directly from their URL.

Now, when the user clicks (taps) on the image, it has to go to another page to show the detail of that image (and it was working fine, when saving the pic, since I named them by the id (id.png))

is there anyway I can name the ImageSource to be this id, or give it like a property (Title or Name)?

var pics = from special in GlobalVariables.Special
                       where special.special == "1"
                       select new { id =, name =, image = special.banner_image, featured = special.special };

            foreach (var item in pics)
                await savePicToDisk(item.image,,, item.featured);

So, then, instead of save them:

List<ImageSource> listOfImages = new List<ImageSource>();    

string url = "" + picAddress;

                    ImageSource urlOfPic = new BitmapImage(new Uri(url, UriKind.Absolute));


Then, where I have to show them, I just bind it to the flipview:

flipView1.DataContext = Classes.Special.listOfImages;

asked 2 mins ago

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at

Set a name for each ImageSource in a list. WindowsPhone 8.1

Aucun commentaire:

Enregistrer un commentaire