How to I set a column to only show the image and not the text. I have an image being set in each cell based on it's value (either 1 or 0), but I don't want the 1 or 0 to show up. When I set the
ProductGrid.DisplayLayout.Bands[0].Columns["Sensitive"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Image;
nothing shows up. Any ideas of how to do this simply?
Thank you,
Susan
Hi Susan,
The Image Style of the column displays the actual cell value as an image. But your cell values are not images, they are numeric (0 or 1), so this won't work.
Do you want the cell to act like a checkbox? If so, you could achieve what you want to do using the UltraCheckEditor control in Custom Style.
Another option would be to use a ValueList and set it's DisplayStyle to Picture.
Still a third option would be to use a CreationFilter to override the creation of the cell elements.
It depends what you want - a checkbox, a dropdown, or just a read-only cell.
Hi
I have a very similar problem. I have a grid with a UltraCombo in one column. In the UltraCombo there are only images shown. This works if theUltraCombo is droppeddown. But if I select one item in the combo, in the grid isn't displayed the image,there I see: System.Byte[.
I tried to set the ColumnStyle of the grid column to Image, but then I get an error. How can I make, that in the grid the selected Image is shown?
Best regards
Clay
Hi Clay,
I need more information. What data type is the grid column? What's the data type of the column in the dropdown that contains the images?
Hi Mike
I made the following:
-a UltraGrid with a column that cointains integer values. Set the column style to DropDownList.
-a UltraCombo with two columns. One column with integers, one column with byte[ (Images). set column style of the second column to Image. set DisplayMember to second column (Image), set ValueMember to first column (integer)
-set the UltraCombo to the ValueList of the grid column.
This works everywhere I have only text as DisplayMember but not with Image as DisplayMember. I just want to see the selected Image in the grid, not the number or a text. Is that possible?
Thank you and best regards
I don't think this will work the way you have it. The problem is that when you have a dropdown in a cell, the grid uses a Combo Editor for that cell. The Combo Editor can't display an image from a Byte array. In order to do that, you would have to use a different type of editor (an UltraPictureBox, basically).
Using an UltraCombo to provide a dropdown list in a cell is rather inefficient, anyway. What you should use is a ValueList.
Here's what you do:
In the InitializeLayout event of the grid, add a ValueList to the e.Layout.ValueLists collection. You can bind this list if you list or populate it manually with your integers. Then you need to set the Appearance.Image on each ValueList item on the list. Set the DisplayStyle on the ValueList to Picture and use this ValueList as the ValueList property of the column.
Mike -- How do I control the size of the ValuList dropdown? I want it to expand to the full list.
Set the MaxDropDownItems to something bigger. It default to 8, I think.