Diagram / Commanding / Ribbon / Diagram Ribbon Overview
In This Topic
    Diagram Ribbon 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 ribbon interface. There are two ways to create a ribbon associated with a drawing view:

     Diagram View with Ribbon Control

    If you are not creating a cross-platform application, the easiest way to create a drawing view with ribbon is to use the Visual Studio designer and drop an NDrawingViewWithRibbonControl from the Visiual Studio toolbox to your form/window. Check out the Diagram Ribbon Designer topic for more information on how to use the Visual Studio designer to customize the diagram ribbon.

    Alternatively, you can use the NDrawingViewWithRibbon class to add a drawing view with ribbon to you form/window programatically. The example below demonstrates how to create a drawing view with ribbon 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 ribbon
    Copy Code
    NDrawingViewWithRibbon drawingViewWithRibbon = new NDrawingViewWithRibbon(); // Create a drawing view with a ribbon
    NDrawingView drawingView = drawingViewWithRibbon.View; // Get the drawing view
    
    // Create a NOV widget host that hosts the drawing view with ribbon
    NNovWidgetHost<NWidget> novHost = new NNovWidgetHost<NWidget>(drawingViewWithRibbon);
    
     Diagram Ribbon Builder

    NOV Diagram provides a ribbon builder that can be used to create and associate ribbon commanding UI to a drawing view. The builder is represented by the NDiagramRibbonBuilder class.

    The following code fragment demonstrates how to create a ribbon-based commanding UI using a diagram ribbon builder and associate it with a drawing view:

    Create ribbon UI using a ribbon builder
    Copy Code
    NDiagramRibbonBuilder ribbonBuilder = new NDiagramRibbonBuilder();
    NCommandUIHolder drawingViewWithRibbon = ribbonBuilder.CreateUI(drawingView);
    
    See Also