Is such a thing possible either automatically or manually?
I've got a Form I have to use in my application that I'm getting from a .dll (written and maintained by another group). The form dynamically generates standard menu options based on certain factors outside of my knowledge/control.
Basically, I need to drop this Form onto my app as an MDI child. My app is all Infragistics, with an UltraToolbarsManager ribbon bar calling the shots.
What I really need is to display the Menu items from the MDI child in my parent Form when the MDI child is the active view. Obviously this is automatically taken care of if the child had it's own UltraToolbarsManager, but since it's just got a standard MenuStrip, I'm getting nothing.
This is actually a pretty critical issue, and I'm not really sure how to proceed.
Any help would be greatly appreciated.
TIA!
byucygnus,
The UltraToolbarsManager does not work with ToolStripMenuItems; it does not know what to do with them when you open an MDI child form, so no merging will occur. When you open your MDI child form what you will need to do is manually remove or hide your MenuStrip, and for each of the ToolStripMenuItems add either a PopupMenuTool or a ButtonTool to the UltraToolbarsManager's Ribbon. You will also need to hide/show them based on which MDI child form is active.
~Kim~
Here's the code I added to take my menus and turn them into ribbon tabs:
this.ultraToolbarsManager1.Ribbon.NonInheritedRibbonTabs.Clear(); foreach (ToolStripItem item in myMenuStrip.Items) { ToolStripDropDownItem dropDownItem = item as ToolStripDropDownItem; if (dropDownItem != null) { RibbonTab ribbonTabDevice = new RibbonTab(item.Text); RibbonGroup ribbonGroupDevice = new RibbonGroup(item.Text); ribbonTabDevice.Caption = item.Text; ribbonGroupDevice.Caption = item.Text; foreach (ToolStripItem childItem in dropDownItem.DropDown.Items) { ButtonTool buttonTool = new ButtonTool(childItem.Text); buttonTool.SharedProps.Caption = childItem.Text; ribbonGroupDevice.Tools.Add(buttonTool); } ribbonTabDevice.Groups.AddRange(new[] {ribbonGroupDevice}); ultraToolbarsManager1.Ribbon.NonInheritedRibbonTabs.AddRange(new[] {ribbonTabDevice}); } } ultraToolbarsManager1.RefreshMerge();
Unfortunately, this is crashing out with a "Key not found: parameter name key" exception.
Any ideas?
You need to add the ButtonTool to the UltraToolbarsManager's root Tools collection rather than the RibbonGroup's Tools collection, and then use the tool's Key when putting it into the RibbonGroup. Please see this article in our online documentation for more information and a code snippet that should be helpful.
Got it!
Thank you very much.
A little "PerformClick" action got this puppy working.
Hi
this code also work for me, can you share the code to handle the click events?
Thanks.
MenuItems (and Buttons, etc) have a public PerformClick() method available to trigger their Click() event. That's pretty much going to be your only avenue to force the Click() to happen. You'll drive yourself crazy trying trigger events on a control externally. The short answer is that it can't be done.