none
CommandBarComboBox.Change Event does not fire RRS feed

  • Question

  • Now I know this question and it's variants have been asked like 5 times, but only one of them is exactly the same, it was asked in 2007, and never answered.

    The issue is that the Change event either never fires when you change the contents of the combobox no matter through code or manipulating the UI.

    The handler binding code definitely runs, and no errors are thrown. Any insight would be appreciated.
    Friday, April 15, 2011 4:40 AM

Answers

  • EventHandler was being garbagecollected, just did var c = DropDown; and it works now
    • Marked as answer by Kit C Tuesday, April 19, 2011 9:54 PM
    Tuesday, April 19, 2011 9:54 PM

All replies

  • Hello Kit,

    where? In the RibbonUI or an Outlook.CommandBar?

    What Office versione? Sample code to reproduce?

    Greets - Helmut


    Helmut Obertanner [http://www.x4u.de] [http://www.outlooksharp.de]
    Friday, April 15, 2011 5:55 AM
    Answerer
  • Hi Kit

    In which appication are you working?


    Cindy Meister, VSTO/Word MVP
    Friday, April 15, 2011 6:27 AM
    Moderator
  •  

    Ah sorry about that, details would probably be useful wouldn't they?

     

    This is an Outlook 2007 addin, and the dropdown appears in the 'Outlook.Explorer' window, and as we all know, O2007 doesn't have a ribbon in the explorer window.

     

            private void AddToolBars()
            {

                    CommandBar itemToolBar = null;

                    CommandBarComboBox DropDown =
                        (CommandBarComboBox)itemToolBar.Controls.Add(MsoControlType.msoControlComboBox, Type.Missing, Type.Missing, Type.Missing);

                    SetDropDown(DropDown);
                    itemToolBar.Visible = true;


                    DropDown.Change += (DropDown_Change);           
            }

    I've got a breakpoint at the start of DropDown_Change, and it is never triggered. Unless I'm supposed to pass a value other than msoControlComboBox to it?

    And here's a bit more code :

            private void SetDropDown(CommandBarComboBox DropDown)
            {
                foreach (SiteConnection s in Global.SiteConnectionManager.ListSiteConnections())
                    DropDown.AddItem(s.Site.Name);
                Settings z = new Settings();
                DropDown.Text = z.default;
            }


    SetDropDown does populate the dropdown list and set the default text as the code suggests.
    Sunday, April 17, 2011 9:27 PM
  • EventHandler was being garbagecollected, just did var c = DropDown; and it works now
    • Marked as answer by Kit C Tuesday, April 19, 2011 9:54 PM
    Tuesday, April 19, 2011 9:54 PM