I'm struggling using XAML variables in a loop, my problem is detailed below :
I've a foreach()
loop, I've 4 images in XAML called let's say image1, image2, image3, image4
now I would like to associate a image that I've got its path in my foreach loop to each image
variable.
An obvious solution would be :
foreach() {
//my stuff
image1.Source = bitmapSource;
image2.Source = bitmapSource;
image3.Source = bitmapSource;
image4.Source = bitmapSource;
}
But this solution is not flexible, I thought about putting my image
variables in an array but I don't think that is possible (at least I haven't found anything that goes in this way).
What's the best / cleanest way to do it ? Thanks