We have used objects as cell values to display textual values (the object exposes its own ToString method that the grid uses to obtain the value to display) and that works very well. We change the value of some public property of the class in the underlying data and the grid updates the cell with the value returned from the ToString method.
We now want to use the same technique to display a variety of images in the cell on some value that is assigned to a property of the object. Is this possible and if so, how?
Thanks,
Dana
Thanks for the sample, however, that is not really what we are trying to accomplish.
What we want to do is bind the grid to table with a column that is an object type. Lets call it cStatusImage. cStatusImage has a public property called Value. Given the value of the property, we want the cell to display an image that is returned by the object. We use the same technique to do domain-specific formatting of values by having the ToString method of the object return the formatted value since the grid automatically evaluates that to obtain the value to display in the cell.
Does the grid evaluate some other method by default when the display style of a cell is set to image or must we resort to using a DrawFilter?
Hello Dana,
In order to display a variety of images in a cell the ToString method could also be used. When the value of the property is changed the method returns a value that indicates that in the cell should be displayed images. If you want the whole cell to simply be an image without any text and without any editing, then you should set the Style of the cell to Image. Because a cell in the UltraGrid can show just one image and there is no built-in functionality to allow for a single cell to show more than one simultaneously you can dynamically combine all of the images to be displayed into a single Bitmap object and then display that bitmap in the cell. More information about multiple images in a cell you could find here:
devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=6018
I’ve implemented this suggestion in a simple sample, and you could run and evaluate it, please see attached zip.
Please do not hesitate to contact me if you have any further question.