Nevron Open Vision Documentation
Diagram / Commanding / Command Bars / Diagram Command Bars Overview
In This Topic
    Diagram Command Bars Overview
    In This Topic

    NOV Diagram provides a lot of commands and settings most of which can be shown to the end user in a command bars interface (menu and toolbars). There are two ways to create command bars associated with a drawing view:

     Drawing View with Command Bars Control

    The easiest way to create a drawing view with command bars is to use the Visual Studio designer and drop an NDrawingViewWithCommandBarsControl from the Visiual Studio toolbox to your form/window. Check out the Diagram Command Bars Designer topic for more information on how to use the Visual Studio designer to customize the diagram command bars.

    Alternatively, you can use the NDrawingViewWithCommandBars class to add a drawing view with command bars to your form/window programatically. The example below demonstrates how to create a drawing view with command bars hosted in a NOV widget host. You can then add this host to a form's Controls collection if you are creating a WinForms application, set it as the Content of a WPF window in a WPF application project or to the ContentView of a Xamarin.Mac window.

    Create a drawing view with command bars
    Copy Code
    NDrawingViewWithCommandBars commandBarsUI = new NDrawingViewWithCommandBars(); // Create a drawing view with command bars
    NDrawingView drawingView = ribbonUI.View; // Get the drawing view
    
    // Create a NOV widget host that hosts the drawing view with command bars
    NNovWidgetHost<NWidget> novHost = new NNovWidgetHost<NWidget>(commandBarsUI);
    
     Diagram Command Bar Builder

    NOV Diagram provides a command bar builder that can be used to create some menus and toolbars to control and edit the drawing view and its shapes. This builder is represented by the class NDiagramCommandBarBuilder.

    The easiest way to create a drawing view with command bars (menus and toolbars) is to use the NDrawingViewWithCommandBars class. The example below demonstrates how to create a drawing view with command bars hosted in a NOV widget host. You can then add this host to a form's Controls collection if you are creating a WinForms application, set it as the Content of a WPF window in a WPF application project or to the ContentView of a Xamarin.Mac window.

    Create a Drawing View with Command Bars
    Copy Code
    NNovWidgetHost<NDrawingViewWithCommandBars> novContent = new NNovWidgetHost<NDrawingViewWithCommandBars>();
    

    Another way to create a command bar based commanding UI and associate it with a drawing view is:

    Create Command Bars UI
    Copy Code
    NDiagramCommandBarBuilder commandBarBuilder = new NDiagramCommandBarBuilder();
    NWidget uiWidget = commandBarBuilder.CreateUI(drawingView);
    
    See Also