I think the problem will be best illustrated with the example.
I have an MDI application. In its child form, part of the "View" menu is constructed in the following way:
foreach (Viewer v in ViewerPlugins)
BarItem bi = new BarItem(v.Name, new EventHandler(addViewer_Click));
// pbi stands for "parentBarItem"
Everything worked like a charm until we decided to add the "View" menu to the main form. After that, the dynamically constructed part disappeared from the menu for the obvious reason - the merged menu must have used the ParentBarItem "View" from the main form''s menu.
My question is simple - is it possible to get it back without losing the luxury of automatic menu merging?
ADAdministrator Syncfusion Team April 26, 2004 10:33 AM
I have created a sample application as per my understanding of your specifications above. Please refer to the sample and let me know if I have understood your problem correctly. If not, kindly modify the sample to show the problem that you are facing and send it back to us so that we could further investigate this issue. We appreciate your cooperation, and thanks for choosing Syncfusion products.
ASAndrew SkalkinApril 26, 2004 03:07 PM
>I have created a sample application as per my understanding of your specifications above.
This sample application doesn''t have a merged menu. Attached is the modified example (I added the "Common View" category that exists in both main and child forms).
ADAdministrator Syncfusion Team April 28, 2004 06:18 AM
Thanks for the modified sample. I could see the above mentioned problem here. Once the menu merging occurs, BarItems cannot be added dynamically through the MainFrameBarManager or ChildFrameBarManager. I have consulted the development team in this regard, and will update as soon as I hear from them. We appreciate your patience, and thanks for choosing Syncfusion products.
ADAdministrator Syncfusion Team April 28, 2004 06:53 AM
After having further investigated this issue, I would like to inform you that you would have to get hold of the merged ParentBarItem of the parent-child menus by invoking the GetMergedEquivalent method, and then dynamically add the BarItems to that one.
Often in a MDI scenario, ParentBarItems created during design-time in the MDI Parent and MDI children are merged together (if satisfying the merge criteria) into a new ParentBarItem which will replace the original in the menu structure. Once replaced, changes made to the original ParentBarItem, like adding a new BarItem will not be reflected in the merged one. So, you should access the merged item directly to add child BarItems.
The newly added BarItems will then stay until the merging is lost (could happen when a different child form gets activated, etc).
So, the recommended way is to keep all the required BarItems in the mainform''s ParentBarItem right from the beginning, before the merge, and show/hide them as necessary (instead of adding/removing them). I have also modified your previous sample accordingly and have attached_it_here. Please refer to it and let me know if you need any other information. We appreciate your continued interest in Syncfusion products.