I am using Infragistics UltraToolbarsManagerWorkspace in Smart Client Application without a separate layout project.
I've Used following code to register the Main menu.
RootWorkItem.UIExtensionSites.RegisterSite(UIExtensionSiteNames.MainMenu, this.Shell.ToolbarsWorkspace.Toolbars[0]);
I have couple of questions regarding the menu creation.
1. How a menu item (Button Tool or Popupmenutool or menu separator ) can be added to existing popup menu at the required location from different modules?2. How to remove all menu items from the Toolbars manager and recreate them [ needed for localization]? used following code to remove all items, but it does not remove the Top most menu items [ File, Edit, View, Windows, Help etc] ArrayList uiElementArray = new ArrayList(); foreach (PopupMenuTool toolbar in
WorkItem.RootWorkItem.UIExtensionSites["MainMenu"]) { WorkItem.UIExtensionSites.UnregisterSite(toolbar.SharedProps.Caption); uiElementArray.Add(toolbar); int toolscount = toolbar.Tools.Count; for (int toolIndex = toolscount - 1; toolIndex >= 0; toolIndex--) { toolbar.Tools.RemoveAt(toolIndex); } }
object[] uiElements = uiElementArray.ToArray();
foreach (object uielement in uiElements) { WorkItem.RootWorkItem.UIExtensionSites["MainMenu"].Remove(uielement); }
Are the top level tools in your main menu toolbar defined at design-time, or do you add then at run-time by adding PopupMenuTool instances to the UIExtensionSite for the main menu? If the former, I think this is correct. You will only be able to remove tools through the UIExtensionSite if they were added through the same UIExtensionSite. However, if you did add the top level items with the UIExtensionSite, this might be a bug and I would recommend submitting the issue to the support group: http://ko.infragistics.com/gethelp.