Hello out there,
I have an ComboBox which is connected to a DataSet with small Images (and an hidden value column).
If I press the Button on the ComboBox, the images are show and I can select one.
But, when I do this, the Image is not shown in the Combobox, but it's type: System.Drawing....
How can I modifiy the ComboBox to show my Images?
Thanks,
Frank
Hi Frank,
I think you will need to use UltraComboEditor for this instead of UltraCombo.
Assuming you bind the UltraComboEditor to some data source, you would loop through the items in the list and assign an Appearance.Image to each one. Then you tell the list to display the images by setting:
this.ultraComboEditor1.Items[0].ValueList.DisplayStyle = ValueListDisplayStyle.Picture;
I set up an UltraComboEditor as described (except it's not bound -- I initialize a static list) and made it the EditorControl of a column in a tree. The tree has an image list, and the column data values are integer indices into it. The tree is initially displayed correctly.
The editor dropdown arrow is always visible (OK for now, though I'd like it to appear on hover as in the "grid with editors" sample).
When I open the dropdown list (only images are shown -- good), the image in the cell disappears. It should stay the same until I change it.
When I change it by clicking an item in the list, the list closes up but there is still no image in the cell. If I exit the application without any further action, there is an invalid index exception in Dispose(). If I instead click outside the tree, the old image appears and no exception occurs on app exit.
I subscribed to the editor's SelectionChanged, ValueChanged, and SelectionChangeCommitted events, but none of them are ever fired. (I verified that the lines of code doing the subscriptions do get executed).
Any ideas, either on how to get the editor to work, or on how to debug (i.e. why I'm not seeing events)?
By the way, are there any books on using Infragistics components?
Hi,
I can't see anything wrong with this code. This looks like a bug to me. When the cell is active, for some reason, it's just not showing the image.
I'm forwarding this thread over to Infragistics Developer Support so they can write this up for developer review.
Sure, see attached.
We seem to be going in circles here. :)
Perhaps it would be best if you created a small sample project demonstrating the behavior you are getting so I can see what's wrong.
I switched the datatype to integer and there was no difference in behavior! In any case...
Your comments have me thinking I don't need the unbound column. I should be able to get what I want by assigning the UltraComboEditor as the EditorControl of the original integer column and just display as images.
In fact I was able to do this, so it's a step forward. I am now able to change the value via the dropdown of images, but there are still two problems:
1) When a cell enters edit mode and the dropdown list is opened, the current cell value disappears.
2) When a list item is selected and the dropdown closes, the cell doesn't show its new image until it loses focus.
It seems the WinComboEditor is confused about how to display the current value when in edit mode. How can I tell it to take the current value and use it as an index into the imagelist? Remember that the value list already displays correctly, and after changing focus to another cell, the first cell repaints correctly.
bobgru said:The column on which the EditorControl is set has DataType = typeof(Bitmap).
Okay... that's why it doesn't work. If your ValueList has integers in it, then when you select an item on the ValueList, it will try to put an integer into the cell. An integer is not a Bitmap and cannot be converted to one.
If you want the column to be of type Bitmap, then your ValueList would have to contain Bitmap values. If you are mapping an integer value to an image, then you should make the column of type Integer.