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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding new menu item to already merged menus.

Thread ID:





19932 Oct 6,2004 03:27 PM UTC Oct 6,2004 06:27 PM UTC WinForms 2
Tags: Tools
Andrew Skalkin
Asked On October 6, 2004 03:27 PM UTC

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); }

Andrew Skalkin
Replied On 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 :)

Administrator [Syncfusion]
Replied On 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.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon