Add Submenu

Topics: CAB & Smart Client Software Factory
Jul 31, 2007 at 9:54 AM


I´m trying to add a submenu dynamically to my File-Menu.

To do this, i registered the file menu in "ShellLayoutViewPresenter" like this:
WorkItem.UIExtensionSites.RegisterSite(UIExtensionSiteNames.FileMenu, View.FileMenu)

Added the following code to UIExtensionSiteNames:
public const string FileMenu = "FileMenu";

Then added the following code to the ShellLayoutViewPresenter:
internal ToolStripMenuItem FileMenu
get { return _fileToolStripMenuItem; }

finally, I tried to extend the menu in my modules Modulecontroller using the ExtendMenu function like this:

ToolStripMenuItem objMenuItem = new ToolStripMenuItem();
objMenuItem.Name = "_showTaskList";
objMenuItem.Tag = "ShowTaskList";
objMenuItem.Text = Properties.Resources.ModuleTitle;
WorkItem.Commands["ShowTaskList"].AddInvoker(objMenuItem, "Click");

When i start the application, the menu item is being displayed, but not as a subitem of my file menu. It´s being displayed after my file menu.

What am I doing wrong?

Thanx for your help in advance.

Jul 31, 2007 at 10:48 AM

WorkItem.UIExtensionSites.RegisterSite(UIExtensionSiteNames.FileMenu, View.FileMenu)

Try changing the above to

Jul 31, 2007 at 11:11 AM
Worked perfectly.

Thank you very much!