c# - How to add images in a objectlistview -
i extremely confused on how use control properly, attempts create media library , show cover art of movies in detailed view not understanding how associate particular column particular image. advice/tips?
i have model object using contains movie details
public class moviedetails { public string moviename { get; set; } public string key { get; set; } public string id { get; set; } public string coverarturi { get; set; } public string movieuri { get; set; } public string downloaduri { get; set; } public int itemcount { get; set; } } //setup columns generator.generatecolumns(objectlistview2, typeof(moviedetails), true); //show movies a-z displayallmovies(); public void displayallmovies() { try { objectlistview2.updateobjects(movies); } catch (exception) { throw; } }
and how dyanmically add images imagelist, key same id/key of object class
string imgloc = string.format(@".\imgs\{0}.jpg", chunk.id); imagelist1.images.add(chunk.id, new bitmap(imgloc));
this unrelated question, instead of
objectlistview2.updateobjects(movies);
you want use setobjects
method.
regarding using images may find my answer here useful.
as side note, while using
generator.generatecolumns(objectlistview2, typeof(moviedetails), true);
is easy, using aspectgetter , aspectsetter handlers of each column gives far more control on column contents.
Comments
Post a Comment