7

I want to place a combobox inside one column of a Xtragrid. I can bind the combobox to array values but how do you bind the combobox to the column?

CodingBarfield
  • 3,392
  • 2
  • 27
  • 54

4 Answers4

9

Use the ColumnEdit property of the column to asign a lookupedit control (new). The lookupedit control is the combo box you need.

  • In doing this you are creating a repository item, which is what is assigned to the edit control of the column – Jiminy May 12 '09 at 02:08
4

This is a simple example of how to add a ComboBox to GridColumn.

Dim xSunday As New DevExpress.XtraEditors.Repository.RepositoryItemComboBox
Me.GridView1.Columns("Sunday").ColumnEdit = xSunday
xSunday.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor
xSunday.Items.Clear()
xSunday.Items.Add("Full")
xSunday.Items.Add("Half")
xSunday.Items.Add("Off")
Soham Dasgupta
  • 5,061
  • 24
  • 79
  • 125
3

In the ColumnEdit property of the column, add a (new) ComboBoxEdit. If you always want it visible, set the ShowButtonMode on the column to always.

This will create a repositoryItemComboBox1 object (that's default name) that you can add items to if you so choose to display in the dropdown list. i.e. repositoryItemComboBox1.Items.add("My Text");

Steven Evers
  • 16,649
  • 19
  • 79
  • 126
2

You can use ColumnEdit and put the proper repository. Then you can do the bindings to that repository.