Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Dynamic Popupmenus in MDI Child
posted

Hi

I'm using Office2007 UI (Ribbon) in an MDI application. In one of the child forms I want to add buttons dynamically to a popupmenu, but they don't show up. I've used the following code:

        private void toolbarsManager_BeforeToolDropdown(object sender, Infragistics.Win.UltraWinToolbars.BeforeToolDropdownEventArgs e)
        {
                    string key = "MyKey";

                    PopupMenuTool tool = (PopupMenuTool)e.Tool;
                    ButtonTool button = new ButtonTool(key);
                    button.SharedProps.Caption = "Name";

                    toolbarsManager.Tools.Add(button);
                    tool.Tools.AddTool(key);

        }

The toolbarsManager is the MDI Child toolbars manager, but I've tried to use the toolbarsManager.MDIParentManger and setting the optional parameter in AddTool to true without success.

UPDATE: If switching child forms back and forth, the dynamically added tools is shown the first time, but then not until you switch forms again. This feels a little bit like a bug to me.

Any help would be appricated. Thanks, Eric