c# - Show bound byte array as an image in DataListView -
i'm using objectlistview
controls set, datalistview
. here code.
datasource
of control:
datalistview1.datasource = this.viewmodel.dataset;
where dataset
populated by:
this.viewmodel.dataset = hsglobals.ctx.entities<product>().all() .where(p => productidlist.contains(p.id)).select(p => new { nazwa = p.name, kod = p.code, dostępność = p.avaiblequantity, typ = p.producttype.name, miara = p.measureunit.name, grafika = p.productimage.image }).tolist();
grafika
byte array - image obtained database.
when datalistview
displayed, grafika
column shows type of field - system.byte[]
.
what have display image?
i've tried imagegetter
, renderer
properties no success.
your initial approach should work, if attach instance of brightideassoftware.imagerenderer
renderer of column.
for imagerenderer, image can sourced from:
- a byte-array (normally when image shown stored value in database)
- an int, treated index image list
- a string, treated first file name, , failing index image list
- an icollection of ints or strings, drawn consecutive images
assuming byte-stream contains valid data create bitmap should do.
edit: make sure ownerdraw
property of olv set true
, iirc requirement custom images drawn.
Comments
Post a Comment