.net - Set image in a cell of Infragistics grid -
i need set image inside cell of grid. have column created in static , other columns bounded dynamically database. conditions , looping of dynamic values have set image in row of static column.
//code of static column created
if ultragridcolumn.tag nothing , ultragridcolumn.key = "transactionstatus" 'configure column ultragridcolumn.cellactivation = if(me.workflowscontroller.selectedworkflow.hasupdateaccess, activation.allowedit, activation.activateonly) ultragridcolumn.cellappearance.backcolor = color.lightyellow ultragridcolumn.cellappearance.fontdata.bold = if(me.workflowscontroller.selectedworkflow.hasupdateaccess, defaultableboolean.true, defaultableboolean.false) ultragridcolumn.cellappearance.fontdata.italic = if(not me.workflowscontroller.selectedworkflow.hasupdateaccess, defaultableboolean.true, defaultableboolean.false) ultragridcolumn.excludefromcolumnchooser = excludefromcolumnchooser.true ultragridcolumn.header.caption = "transaction status" ultragridcolumn.header.tooltiptext = "transaction status." ultragridcolumn.hidden = false ultragridcolumn.style = columnstyle.dropdownlist ultragridcolumn.valuelist = me.workflowscontroller.statusescontroller.statusesvaluelist end if
//code set image
dim transid = transactioncommentscollection.select(function(x) x.transactionid) dim translevelid = transid.intersect(transactionlevelcommentscollection.select(function(x) x.transactionid)) if (translevelid.contains(record.transactionid)) //get corresponding cell here 'set cell image ultragridcell.appearance.image = my.resources.tran_comment_16 ultragridcell.appearance.imagehalign = halign.right ultragridcell.appearance.imagevalign = valign.top end if
how row , cell of column created statically , set image?
since column has valuelist can use appearance of valuelistitems set image , set displaystyle of valuelist infragistics.win.valuelistdisplaystyle.picture.
for example use following c# example:
void ultragrid1_initializelayout(object sender, infragistics.win.ultrawingrid.initializelayouteventargs e) { // column ("department") in grid display valuelist // sample images. values in column // 0 3. // create valuelist 3 items, 1 each color // of traffic light. infragistics.win.valuelist vl = this.getdepartmentsvaluelist(); vl.displaystyle = infragistics.win.valuelistdisplaystyle.picture; (int = 0; < 4; i++) { vl.valuelistitems[i].appearance.image = this.imagelist1.images[i]; } // attach valuelist "department" column in grid. e.layout.bands[0].columns["department"].valuelist = vl; } private infragistics.win.valuelist getdepartmentsvaluelist() { infragistics.win.valuelist vl = new infragistics.win.valuelist(); (int = 0; < 4; i++) { vl.valuelistitems.add(i, string.format("department {0}", i) ); } return vl; }
note limit number of image objects created if using same image multiple times multiple rows. example uses image list dispose called on images prevent memory leaks.
Comments
Post a Comment