Learner
Learner

Reputation:

Devexpress Xtragrid how to add Combobox editor to column

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?

Upvotes: 7

Views: 27015

Answers (4)

Soham Dasgupta
Soham Dasgupta

Reputation: 5199

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")

Upvotes: 4

Steven Evers
Steven Evers

Reputation: 17216

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");

Upvotes: 3

Javier Suero Santos
Javier Suero Santos

Reputation: 572

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

Upvotes: 9

Erick
Erick

Reputation:

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

Upvotes: 2

Related Questions