I'm experiencing some problems with ValueLists and images...
When I have a ValueList containing strings for both Text and Value, and a column string DataType everything works fine. The grid shows a dropdown control and I can select values from the ValueList. However, I want to show images instead of text in the grid. Thus the column DataType is Image, the ValueList is filled with images for Value and strings for Text. The problem is now that the grid no longer shows a dropdown (not even the dropdown button) for the column's cells. It acts just like a plain non-editable cell. Even if I manually specify Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList it doesn't work. With breakpoints I can clearly see the ValueList is correctly set and assigned to the column. It just won't appear as a dropdown...
It's as if the Image DataType blocks AllowEdit on the cells so the dropdown doesn't show.
Any solutions? Workarounds? ...
- Visual Studio 2005 SP1
- Infragistics .NET Advantage 2007.3 + hotfixes
Hi Marc,
MarcCluyts said:Thus the column DataType is Image, the ValueList is filled with images for Value and strings for Text.
Isn't this backward? In order for this to work, the Value in the grid would have to be some non-image value and the DisplayText (which is what's displayed to the user) would be an image.
It seems to me that if the DataType of the column is an image, then you don't need to use DataValue and DiplayText of the ValueListItems at all. You could just use the DataValue and make it an image. Why would you need to translate this into text - unless the Value is the text and the DisplayText is the image.
So the question is, what exactly do you want the cell value to be? Do you want to actually store the image as the Value? Or do you need to store some ID like a string or a number and then just display an image to the user based on that ID?
So... you want the user to drop down a list and see a list of text items, but when they select one, you want the cell to display an image with no text? That seems like it might be alittle confusing to a user. I don't think I've ever seen UI like that.
Displaying an image in a cell doesn't neccessarily mean that the DataType of the field has to be Image. The DataType indicates what you want to store in your data source. An Image is hard to uniquely identify and can't really be sorted or compared, so typically, if you want to display an image, you would use some sort of name or ID to represent the image in the data source and then just have the grid display the appropriate image based on the value.
Displaying text on the list and then having the cell show an Image would be pretty tricky. It would probably require a CreationFilter.
Mike Saltzman"]So... you want the user to drop down a list and see a list of text items, but when they select one, you want the cell to display an image with no text? That seems like it might be alittle confusing to a user. I don't think I've ever seen UI like that.
It's not that weird... For example: A field can contain the values "Male", "Female", "Both" and "None". If you have little space to display the full-width column in the grid you could opt to display only the first letter or something like that. But you could also just display the symbols for male and female. Everyone knows these. Besides, one could still display the images in the ValueList dropdown (through the ValueListItem's Appearance.Image) so there's almost no confusion possible. This is just a simple example. In my case there are several columns that could benefit from this. The icons to be displayed are well known to the users that need to work with the application, so I don't see any problems there...
Mike Saltzman"]Displaying an image in a cell doesn't neccessarily mean that the DataType of the field has to be Image. The DataType indicates what you want to store in your data source. An Image is hard to uniquely identify and can't really be sorted or compared, so typically, if you want to display an image, you would use some sort of name or ID to represent the image in the data source and then just have the grid display the appropriate image based on the value.
It may sound weird, but these "Image" columns have no relation with the DataTable object that's behind the grid. There are no images stored in the DataTable. It would take us a bit too far to explain it, but there's a different mechanism handling this.
But you may be right that my approach is tricky. Maybe it's better to use the Appearance.Image property of the cells... Thanks!