Sebastian Horstmann
Guest
|
Hello,
i am struggling to get the value of adxRibbonComboBox.
I set it at initializing like this:
string[] combobox_items = new string[11];
string year = DateTime.Today.Year.ToString();
for (int i = 0; i < combobox_items.Length; i++)
{
combobox_items[i] = year;
year = (DateTime.Today.Year - (i+1)).ToString();
}
this.adxRibbonComboBox1.Items.Clear();
for (int i = 0; i < combobox_items.Length; i++)
{
AddinExpress.MSO.ADXRibbonItem item = new ADXRibbonItem(this.components);
this.adxRibbonComboBox1.Items.Add(item);
item.Caption = combobox_items[i].ToString();
}
Now i want to get the selected value and wirte it into a textbox like this:
txt_SearchString.Text = ???
I found "adxRibbonComboBox1.Items[1].AsRibbonItem.Caption;" but with this i will always geht item[1]. How can i get the selected value? |
|
Sebastian Horstmann
Guest
|
Okay, i solved it by myself. I changed the adxRibbonComboBox to adxRibbonDropdown.
int index = adxRibbonDropDown1.SelectedItemIndex;
txt_SearchString.Text = adxRibbonDropDown1.Items[index].AsRibbonItem.Caption;
This works for me. |
|
Andrei Smolin
Add-in Express team
Posts: 18830
Joined: 2006-05-11
|
Hello Sebastian,
Great! According to the Office Ribbon Schema, only Dropdown and Gallery provide a way to get the item selected.
Andrei Smolin
Add-in Express Team Leader |
|