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
No, we are good.
Hello Dana,
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?
Thank you for using Infragistics Components.
Hi Dana,
Thanks a lot for the reply. I am glad that you have resolved your issue. Let me know if you have any additional questions.
Thank you for all the feedback.
What we have chosen to do is use a ValueList where we set the DataValue to be the value, the Appearance.Image to be the icon for the cell for each ValueListItem and then set the DisplayStyle for the ValueList to be ValueListDisplayStyle.Picture. The column in the underlying table has the Expression property value set to the name of the "real" value column in the table.
This results in a read-only column in the grid that displays a different image based on the value of a column in the data source.
Hi,
No, the grid has no way of accessing any of the properties on your object. It always uses the ToString method to display the value by default.
The simplest way to achieve what you want would be to hide the 'real' column and add an unbound column to your grid. Set the unbound Column's DataType to the same DataType as your Value property (which is presumably Image or Bitmap or a Byte array that returns an image). You may also need to set the Style property of the unbound column to Image, as well.
Then use the InitializeRow event to get the cStatusImage instance from the 'real', bound, hidden column and copy that Value into the unbound column.