During the constructor of the editor that as the ultragrid, I want to create the dropdown lists for each column that needs it. Currently I've assigned a comboEditor to each column and I configure those at run time, but would be nice if I can just configure the column directly and use the native drop down behavior of the grid without having to use additional controls.
Taking a look at the documentation, the column's ValueList property has both a getter and a setter. In fact, the example specifically sets the ValueList of the column.
The note about the property being "read only" may be an artifact from earlier versions where this may have been true. I'll touch base with our developers to confirm whether or not the statement is accurate in circumstances I'm not aware about, and to get the documentation correted in a future release - whether to simply correct a mistake or to clarify any conditions that may apply.
You're right, I haven't noticed that and I use it a lot. Maybe it means that you can't set the internal properties of the value list?
The quick help on grid.DisplayLayout.Bands[0].Columns[key].ValueList say the property is read only.
However I implemented your suggestion and it works great. I'm slightly disturbed that the hot tip and documentation says it is read only, so I'll need to test this heavily, but otherwise this is exactly what I was after.
My editor is part of a wizard, in which previous choices change the value of the drop down list.
In the constructor I basically have:
ultraComboEditorScales.Items.Clear();ultraComboEditorScales.Items.Add("", "none"); if (!ConformanceUtil.EmptyList(scales)) { foreach (Scale scale in scales) { ultraComboEditorScales.Items.Add(scale.ID, scale.ID); } }
ultraComboEditorScales.Items.Clear();
if (!ConformanceUtil.EmptyList(scales)) {
ultraComboEditorScales.Items.Add(scale.ID, scale.ID);
}
On the deisgner I have the grid usign dock.Fill, plus 1 ultraComboEditor place on top of the grid and set to invisible. Then thru the custom designer for the grid, I set the control editor to ultraComboEditorScales. Working very well this way, with the exception the value never changes, just the Text of the cell. So I just test for that and manual change my models in the CellCHanged event.
Use a ValueList.
var list = grid.DisplayLayout.ValueLists.Add();
list.ValueListItems.Add(...
grid.DisplayLayoutBands[0].Columns[key].ValueList = list.
You can also cell a different value list for each cell, and use a BindableValueList that can get a data source.