string[] list = Directory.GetFiles(@"Resources/", "*.jpg");
lvDataBinding.Items.Add(list[0]);
So the folder Resources contains several images that I want to add to an array so I can use them in an easier way.
I need to display them in a window (each one when a different listviewitem is selected).
I would like to know if I can also store them in a class alongside the ListViewItem name and description. So I can do like:
Article article1= new Article();
article1.Name = "Article name";
article1.Description = "Long article description etc etc";
article1.Image= images[0];
lvDataBinding.Items.Add(artikel1);
And then class would be something like this I guess?
public class Article
{
public string Name{ get; set; }
public string Description{ get; set; }
public Image? Image { get; set; }
public override string ToString()
{
return Naziv;
}
}
P.S.: I respect all suggestions on how I could do this on another better way. Im sure there are better ways, but I am doing a college assignment and I'm limited on time, also my teacher suggested to "transfer" objects into new windows.
Thanks in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…