Hi,
I'm trying to bind an UltraCombo to an UltraGrid cell.
My UltraCombo is configured to have multiple selection with checkboxs.
When the UltraCombo is not binded to the grid i can use the multiple selection normally and it works fine, but after i bind it to the grid i can only choose one value (checkbox) and then the UltraCombo closes.
Is there a way to make it stay open and allow me to choose multiple items?
Adding my code (happens on the grid's InitializeLayout event):
UltraCombo ucbx2 = new UltraCombo(); ucbx2.BindingContext = this.BindingContext; ucbx2.DataSource = mdsLocations.LOCATION; ucbx2.DisplayMember = "DESCRIPTION"; ucbx2.ValueMember = "LOCATION_KEY"; UltraGridColumn ugc = ucbx2.DisplayLayout.Bands[0].Columns.Add(); ugc.Key = "Selected"; ugc.Header.Caption = string.Empty; ugc.Header.CheckBoxVisibility = HeaderCheckBoxVisibility.Always; ugc.DataType = typeof(bool); ugc.Header.VisiblePosition = 0;
ucbx2.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems; ucbx2.CheckedListSettings.ListSeparator = " / "; ucbx2.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item; ucbx2.DisplayMember = "DESCRIPTION"; ucbx2.ValueMember = "LOCATION_KEY"; ucbx2.CheckedListSettings.CheckStateMember = "Selected";
e.Layout.Bands[0].Columns[LOCATION_KEYColumn.ColumnName].ValueList = ucbx2; e.Layout.Bands[0].Columns[LOCATION_KEYColumn.ColumnName].Header.Caption = "Location"; e.Layout.Bands[0].Columns[LOCATION_KEYColumn.ColumnName].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
Thanks,
Ziv.
Just for the sake of completion and for future reference:
Changing the binded column to be object[] did the trick partially.
I needed to remove the style of the column:
//e.Layout.Bands[0].Columns[LOCATION_KEYColumn.ColumnName].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
Thanks for the help!
Hi Mike,
Changing the property from ValueList to EditorComponent did the trick! Now i can select multiple items from the combo.
The location key column is of an integer type - i'll change it to an object array.
Can you refer me to any useful links about the binding procedure of a multi select ultracombo to an ultragrid?
Thanks!
Sorry... I took another look and I apparently misunderstood your original code snippet. The DataType of the Selected Column should be bool - it was right the way you have it.
The issue here is most likely the DataType of the grid column you are attaching the Combo to. What is the DataType of the "LOCATION_KEYColumn.ColumnName" column? It needs to be an object array.
Also, I think this line needs to be changed:
e.Layout.Bands[0].Columns[LOCATION_KEYColumn.ColumnName].ValueList = ucbx2;
to
e.Layout.Bands[0].Columns[LOCATION_KEYColumn.ColumnName].EditorComponent = ucbx2;
I think there's some confusion here.
I understand that you are unable to select multiple values from the combo. I'm not sure exactly why that is, but there are a number of things you are doing here that don't make a lot of sense.
What are you expecting to display in the cell? The screen shot you have here shows a blank cell, and you mention that you want the cell to show checkboxes. But that's not how the Combo works. If you select multiple items on the list, then the cell will display a string listing the selected items. You can't have a checkbox in the cell, since a CheckBox only represents a single value, not a list of values.
Also... why are you turning on the header checkbox for this column? What do you expect this to do?
If you can post a small sample project I can run, I would be happy to try to figure out why you cannot multi-select. But I am concerned that there is some confusion here in terms of what you are actually trying to achieve.
Hi Mike.
Changing this made my UltraCombo drop down to be without check boxes (see picture) and still whenever i click on one row in the UltraCombo it closes the UltraCombo immediately and i cannot really multi select rows from it.
Any ideas?