How to add a menu dynamically with Command

Topics: CAB & Smart Client Software Factory
Aug 4, 2006 at 3:34 PM
originally posted by: ramyrams

I have added the menu like

PopupMenuTool Services = new PopupMenuTool("Services");
Services.SharedProps.Caption = "Services";

this.UIExtensionSites.RegisterSite(“ServicesDropDown”, Services.Tools);

foreach (ToolBase bt in serviceMenu.Tools)
ButtonTool ServiceChild = new ButtonTool(bt.SharedProps.Caption);
ServiceChild.SharedProps.Caption = bt.SharedProps.Caption;
this.Commandsbt.Key.ToString().AddInvoker(ServiceChild, "ToolClick");
ServiceChild = null;

Note: PopupMenuTool is Infragistic tools.

Currently assume that I have 3 item in Popupment then I will 3 commands as

public void OnCSTasks1ViewSelected(object sender, EventArgs e)
LoadWorkItem("CS Tasks1");

public void OnCSTasks2ViewSelected(object sender, EventArgs e)
LoadWorkItem("CS Tasks2");

public void OnCSTasks3ViewSelected(object sender, EventArgs e)
LoadWorkItem("CS Tasks3");

Is there any way to dynamically added the commands to each item?

Basically I need to add a menu item dynamically.
Aug 4, 2006 at 9:29 PM
originally posted by: askew

Chris Holmes has a blog entry that might interest you. He uses a Service internal to his Application to provide toolstrip menu items dynamically. I think his buttons know how to run the Commands that match their names in his example.

You are setting "ServiceChild = null;" in your code...? I'm not familiar with the Infragistics tools.
Aug 5, 2006 at 8:30 AM
originally posted by: ramyrams

Thanks for the URL let me thy this.