Home Forums WinForms controls Xceed Grid for WinForms Combobox editor in unbound mode – how to add items? Reply To: Combobox editor in unbound mode – how to add items?

User (Old forums)
Member
Post count: 23064

Hi there, 

If you try to drop a WinComboBox on a Data Grid for .NET using the Designer, the WinComboBox will actually be dropped on the form below the grid. 

Where do you want that combobox exactly?  On a particular cell of the insertion row?  For every rows of your grid in a particular column?  On a certain row of your grid?  You can do all of these but, unfortunately, you can’t really put a combobox on a grid like you can put one on a form.  There are many ways to implement a comboxbox on a grid.  The best one is the one that is the most intuitive and practical for your scenario.  And, yes, you will have to do this by writing code.

You should check the RichCellEditor project normally located in this folder:

C:\Xceed Component Samples\Xceed Grid for .NET 3.8\Samples\CSharp\RichCellEditor

In particular, the method CreateComboBoxes() from RichCellEditors.cs should give a you a good idea, although this example is for a bound combobox.  It should still give you a good starting point. 

To add multiple items to a combobox, you can use the combobox.Items.AddRange(ICollection valuesCollection) method. 

Light to you, too! 

Imported from legacy forums. Posted by Ghislain (had 1258 views)