2
votes

I have a DevExpress Grid control that is dynamically loaded from a DataTable. All columns are loaded from the DataTable except for one in which I want to use a ComboBoxEdit for selecting three different values.

All rows show correctly, and the comboxbox shows in the grid for each row. However, I can't get it to drop down. No matter what I do there seems to be no values in the dropdown, or it does not drop down for some other reason. When I add a value to that column also it shows in the grid, but I still get no response when clicking the dropdown-button on the combobox.

The user should be able to select one of the three values, but not type anything or add values.

Here's my call to add rows to the gridview:

F1Grid.DataSource = accounts;
F1Grid.RefreshDataSource();
F1GridView.RefreshData();

This is the code I'm using to initialize the repository combobox:

RepositoryItemComboBox repositoryItemBetVillk = new RepositoryItemComboBox();
repositoryItemBetVillk.Items.Clear();
repositoryItemBetVillk.Items.AddRange(new string[] { "12", "24", "36"});
repositoryItemBetVillk.ShowDropDown = ShowDropDown.SingleClick;
repositoryItemBetVillk.AllowDropDownWhenReadOnly = DefaultBoolean.True;
repositoryItemBetVillk.DropDownRows = 3;
repositoryItemBetVillk.Enabled = true;
repositoryItemBetVillk.ReadOnly = true;
repositoryItemBetVillk.TextEditStyle = TextEditStyles.Standard;
repositoryItemBetVillk.UseCtrlScroll = false;
F1GridView.Columns["BetVillk"].ColumnEdit = repositoryItemBetVillk;

Why doesn't the dropdown work? Am I missing something vital in my initalization?

Help me, Stackoverflow, you're my only hope!

3

3 Answers

1
votes

I started with the same codebase and had the same issue as the person who posted. I changed the following to make it work:

repositoryItemBetVillk.ReadOnly = false;
1
votes

I know it's old but for reference:

repositoryItemBetVillk.ReadOnly = false;
repositoryItemBetVillk.AllowDropDownWhenReadOnly = DefaultBoolean.True;
repositoryItemBetVillk.TextEditStyle = TextEditStyles.DisableTextEditor;

This makes sure user can use ComboBox without ability to type in any other values.

0
votes

I think you are missing something like :

F1Grid.RepositoryItems.Add(repositoryItemBetVillk);

In your code. Try it and let me know