Hello Niranjan,
When you create the context menu in BuildContextMenu you need to pass the Manger property into the constructor parameters:
contextMenu = new NContextMenu(Manager);
contextMenu = new NContextMenu(Manager);
You need to create the offpageCommand as follows:
NCommandContext offpageContext = new NCommandContext();
NCommand offpageCommand = NCommand.FromContext(offpageContext);
Manager.Contexts.Add(offpageContext);
NCommandContext offpageContext = new NCommandContext();
NCommand offpageCommand = NCommand.FromContext(offpageContext);
Manager.Contexts.Add(offpageContext);
Note that you need to add the command's context to the Manager's context collection.
Children commands need to be created the same way but instead of adding their context to the Manager's Contexts collection you have to add them to the Contexts collection of their parent command:
NCommandContext context = new NCommandContext();
NCommand subCmd = NCommand.FromContext(context);
offpageCommand.Context.Contexts.Add(context);
NCommandContext context = new NCommandContext();
NCommand subCmd = NCommand.FromContext(context);
offpageCommand.Context.Contexts.Add(context);
This way when these custom commands were executed the CommandContextExecuted event should fire.
Best Regards,
Nevron Support Team