Home Forums WinForms controls Xceed Grid for WinForms IBindingList, CollectionBase, and comboboxes Reply To: IBindingList, CollectionBase, and comboboxes

User (Old forums)
Member
Post count: 23064

Thanks Charles.  I’ve done as you suggested and it works well except for one thing: before the cell is clicked there aren’t any items in the combobox and the cell is empty.  While loading the items dynamically in the ActivatingControl event is okay, I’d like to be able to set a value programatically once the grid is loaded so the cell isn’t empty.

I’m also a bit unclear on how to set up the column editor.  In my example the Car object has a ExtraOption property which is the currently selected ExtraOption for this Car.  The ExtraOptionList property has the list of ExtraOptions available to this particular Car.  I tried to tie the combobox to the ExtraOptionList but I never could get the column to display in the grid.  The only code I had success with is:

         // Initialize the editor to have a ComboBoxEditor as editor for the ExtraOption column.
        private void ConfigureExtraOptionColumnEditor(IList list)
        {
            Xceed.Grid.Editors.ComboBoxEditor comboBoxEditorManager = new Xceed.Grid.Editors.ComboBoxEditor();
            Xceed.Editors.WinComboBox comboBox = comboBoxEditorManager.TemplateControl;
            comboBox.Columns.Add(new Xceed.Editors.ColumnInfo(“ExtraOption”, typeof(ExtraOption)));
            OrdersGrid.Columns[“ExtraOption”].CellEditorManager = comboBoxEditorManager;
            OrdersGrid.Columns[“ExtraOption”].CellEditorManager.ActivatingControl +=
                  new Xceed.Grid.Editors.CellEditorEventHandler(ExtraOptionCell_ActivatingControl);
        }

But now I find that when I assign a value to the ExtraOption property, the ActivatingControl event never fires and the cell doesn’t have the combobox control or items in it.  Can you see what I doing wrong?  I think it has something to do with the typeof I’m using:
comboBox.Columns.Add(new Xceed.Editors.ColumnInfo(“ExtraOption”, typeof(ExtraOption)));

But again when I used typeof(ExtraOptionList) the column didn’t display at all.

Thanks in advance.

Imported from legacy forums. Posted by slk23 (had 430 views)