Using IMenuCommandService

  • Thread starter Thread starter Dan Reber
  • Start date Start date
D

Dan Reber

I have application that is using IDesignerHost so my users can design
dashboards at runtime. I got the Design and NameCreation, Selection and UI
services working but I cannot get IMenuCommandService implemented. I have
found examples but it looks like they are all for component integration in
the IDE. Does anybody know of some examples for my scenario? Also, does
the app have to use System.Windows.Forms.MainMenu in order to use
IMenuCommandService or can a 3rd party menu tool like Infragistics be used?

Regards,

Dan
 
After more research I was able to supply a context menu using a 3rd party
toolbar control and by overriding ShowContextMenu but

GlobalInvoke(StandardCommands.Delete) <-- see below

is still the only StandardCommands that works. In GlobalInvoke the line,
command.Invoke(); is being executed for all StandardCommands that are passed
in but nothing happens except for StandardCommands.Delete. Any ideas?

Regards,

Dan Reber



public bool GlobalInvoke(System.ComponentModel.Design.CommandID commandID)
{

bool result = false;

MenuCommand command = FindCommand(commandID);

if (command != null)
{
command.Invoke();
result = true;
}

return result;

}
 
Back
Top