We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Adding new menu item to already merged menus.

Hello, I can''t figure out how to properly dynamically add main form''s top-level menu items in my MDI application. The problem would be best demonstrated with the example below: public MainForm() { InitializeComponent(); mainFrameBarManager.RegisterMdiChildTypes(new Type[] {typeof(View)}); // now, I want to dynamically add main form''s top-level menu. // the following code produces no effect if it is executed after the call to RegisterMdiChildTypes. ParentBarItem pbi = new ParentBarItem(); mainFrameBarManager.Items.Add(pbi); mainMenu.Items.Insert(mainMenu.Items.Count - 1, pbi); }

2 Replies

AS Andrew Skalkin October 6, 2004 03:40 PM UTC

The (ugly) way around the problem is creating a number of dummy invisible menu items before the call to RegisterMdiChildTypes and reusing them when needed... This is what I do at the moment but it seriously hurts my aestethic feelings :)

AD Administrator Syncfusion Team October 6, 2004 06:27 PM UTC

Hi Andrew, In a MDI scenario, you should always add the BarItems to the merged Bar''s Items collection and not to the original Bar''s Items collection as shown in code below : this.mainFrameBarManager1.GetMergedEquivalent(this.bar1, this.bar1).Items.Add(pbitem); Please refer to the test sample that illustrates this and let me know if it helps. Regards, Guru Patwal Syncfusion,Inc.

Live Chat Icon For mobile
Up arrow icon