[DevExpress Support Team: CLONED FROM A1402: Can SelectedIndex be set for RepositoryItemComboBox?]
Still I don't understand - once the comboBox has been created, how do I set it to show a specific value from the list? I do not see a "selectedItem" property.
How to select an item in ComboBoxEdit
Answers approved by DevExpress Support
Hi,
Do you use ComboBoxEdit in the Standalone or In-Place mode? If it's the first case, ComboBoxEdit provides the SelectedItem, SelectedIndex, and EditValue properties to set an edit value. If it's the second case, as stated in the Can SelectedIndex be set for RepositoryItemComboBox? KB article, you need to use methods of an editor container.
If that does not help you, elaborate where you use the ComboBoxEdit and when you need to set an edit value.
I look forward to your response.
@demetrius I think i have exactly the same problem
I have a context menu and added a ComboBox to it. In the designer file a RepositoryItemComboBox is added as edit to a BarEditItem by devexpress/visual studio. no code with a combobox appears, so it seems to be somewhere in the RepositoryItemComboBox .
If i add values to the thing i do it by changing the ComboBoxItemCollection collection in RepositoryItemComboBox.Items
But i never see a possiblity to say: RepositoryItemComboBox.SelectedIndex = 0;
Even if i listen to the SelectedIndexChanged event of the RepositoryItemComboBox i do not see which value is selected - only if i cast the sender to ComboBoxEdit and then look at the EditValue i get some information.
I think the original poster has the same problem which i have - how to get the ComboBoxEdit of the RepositoryItemComboBox to just set a selected index.
Maybe it is totaly easy - but right now it is just time consuming to find out how to set this thing. Why is thee no property like in Combobox?
ATM i do something which looks cruel,:
this.BarButtonMenuItem.EditValue = this.RepositoryItemComboBox.Items[0].ToString();
Hello Wolfgang,
Please review the Can SelectedIndex be set for RepositoryItemComboBox? KB article as Svetlana suggested.
I hope you find this information useful. Let me know if you have additional questions.