How to get selected value of adxRibbonComboBox

Add-in Express™ Support Service
That's what is more important than anything else

How to get selected value of adxRibbonComboBox
 
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?
Posted 26 Jul, 2017 10:35:55 Top
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.
Posted 27 Jul, 2017 02:53:41 Top
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
Posted 27 Jul, 2017 04:57:43 Top