Nevron Forum

how can we add or remove the toolbar commands in nDiagramCommandBarManager toolbar

https://www.nevron.com/Forum/Topic6819.aspx

By ginnas k 1 - Friday, August 10, 2012

hi

i have removed the command from the toolbar by using the following code

nDiagramCommandBarsManager1.Toolbars[4].Commands.RemoveAt(1);
so how can i add the removed command to the toolbar

in the documentation they telling about adding the custom commands but here these commands are predefined only so how can i do it

regards
ginnas

By Nevron Support - Friday, August 10, 2012

Hi ginnas k,

The correct way to remove a diagram command from NDiagramCommandBarsManager is by using diagram commander:

NDiagramCommand cmd = nDiagramCommandBarsManager1.Commander.Commands.GetCommandFromId((int)DiagramCommand.About);
nDiagramCommandBarsManager1.Commander.Commands.Remove(cmd);
nDiagramCommandBarsManager1.Recreate();

To add the removed command you can either add the previously removed cashed command or create a new one:

If we have a reference to the removed command we just need to add it to the Commander.Commands collection:

nDiagramCommandBarsManager1.Commander.Commands.Add(cmd);

If we don't just create a new one and add it to Commands collection:

NAboutCommand cmd = new NAboutCommand();
nDiagramCommandBarsManager1.Commander.Commands.Add(cmd);