How do I access the Tool
BarBuilders and the MenuDropDownBuilders from the NDrawingViewWithCommand
BarsControl? I cannot find where these are accessible from the NDrawingViewWithCommand
BarsControl. Also how do I get the
NCommandBarUIBuilder that is associated with my NDrawingViewWithCommand
BarsControl that is on my form?
The help file says the following:
Modifying Builder CollectionsIf you want to remove a given tool
bar 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 tool
bar builders are exposed as constants in the
NDiagramCommandBarBuilder class. For example, to remove the "File" menu and the "Standard" tool
bar 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 tool
bar 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()); |