How do I access the ToolBarBuilders and the MenuDropDownBuilders from the NDrawingViewWithCommandBarsControl? I cannot find where these are accessible from the NDrawingViewWithCommandBarsControl. Also how do I get the
NCommandBarUIBuilder that is associated with my NDrawingViewWithCommandBarsControl that is on my form?
The help file says the following:
Modifying Builder CollectionsIf you want to remove a given toolbar or menu from the builders, you can easily do so by using the
Remove method of the
ToolBarBuilders and
MenuDropDownBuilders collection of the diagram command bar builder respectively. You can get or remove builders by name.The names of all diagram menu and toolbar builders are exposed as constants in the
NDiagramCommandBarBuilder class. For example, to remove the "File" menu and the "Standard" toolbar of a command bars based diagram UI, you can use the following piece of code:
Remove Toolbar and Menu Builders | Copy Code |
---|
commandBarBuilder.MenuDropDownBuilders.Remove(NDiagramCommandBarBuilder.MenuFileName);commandBarBuilder.ToolBarBuilders.Remove(NDiagramCommandBarBuilder.ToolbarStandardName); |
In order to add or insert your own toolbar or menu drop down builder, you can use the
Add or
Insert methods of the corresponding builder collection respectively.
Add Custom Toolbar and Menu Builders | Copy Code |
---|
commandBarBuilder.MenuDropDownBuilders.Insert(1, new CustomMenuBuilder());commandBarBuilder.ToolBarBuilders.Insert(0, new CustomToolBarBuilder()); |