I've got a list box contain a list of cars (lstCars). Each car object got a list of of images (ImagesList). I would like to fill the second ListBox (lstCarImages) with the list images of the slected product. I wrote the attached code (it's just a snippet) but for some reaon it's just not work. Could someone please advice for me what I'm doing wrong or hot to do that correctly? Please pay attention that the Car object got a property which called CarImagesList of ImagesList type and the method GetCarImages returns ImageList object.
Thanks in advance, Lior
Code
The
classes:
public class MyImage
Code
{
BitmapImage image;
Code
public MyImage(BitmapImage bitImage)
Code
{
Code
image = bitImage;
Code
}
Code
public BitmapImage Image
Code
{
Code
get { return image; }
set {value = Image; }
Code
}
Code
}
public class ImagesList : ObservableCollection
Code
{
}
Code
Dummy data
inserting:
Code
Car car1 = new Car();
Code
car1.licenceNumber = "1853535";
Code
car1.CarImagesList = GetCarImages(car1.licenceNumber); // This method return list of the MyImage object
Lior Kooznits32 reputationPosted Feb 18, 2010, 9:13 PM EST
0
Hello lalita,
the car list is actually a regular list contains Car object.
Each one of the object got some fields, among them is the ImagesList.
I had forgot to wirte in my last post that I succeed to bind the data to the first list box, so the problem is only with the second.
Raaj KumarRank #7,836 · 233 reputationPosted Feb 18, 2010, 9:06 PM EST
I have attached a code which resolves your problem. Please have a look at this and let me know if you have any problem
Regards,
Raaj
Lalita Peddi6 reputationPosted Feb 18, 2010, 7:48 PM EST
what is carsList object? have you set the datasource of the list box to carsList?
Best regards
Lalita
Lior Kooznits32 reputationPosted Feb 18, 2010, 9:13 PM EST
the car list is actually a regular list contains Car object.
Each one of the object got some fields, among them is the ImagesList.
I had forgot to wirte in my last post that I succeed to bind the data to the first list box, so the problem is only with the second.
Regards,
Lior
Lior Kooznits32 reputationPosted Feb 19, 2010, 1:07 AM EST
It's working great now!
Raaj KumarRank #7,836 · 233 reputationPosted Feb 19, 2010, 1:27 AM EST