Nevron .NET Vision
User Interface for .NET / User's Guide / Command Bars / Nested Commands

In This Topic
    Nested Commands
    In This Topic
    Nevron command model makes it very easy to create nested commands and drop-down menus. Actually, drop-down menus are created internally and the user does not deal directly with them. The concept is that each command that contains nested commands is responsible for creating and displaying a NMenuWindow control to visualize its children. This menu is created on demand - for example on a left mouse click. Using this approach, creation of complicated nested menus and command hierarchies is a matter of few lines of code.
     Creating Nested Commands

    The following example demonstrates how to create nested commands:

    Copy Code
    //create a NToolbar object first
    NToolbar toolbar = new NToolbar();
    toolbar.DefaultCommandStyle = CommandStyle.Text;
    //create a file command and add it to the toolbar
    NCommand fileCommand = new NCommand();
    fileCommand.Properties.Text = "&File";
    fileCommand.Properties.ShowArrowStyle = ShowArrowStyle.Never;
    //create some nested commands
    NCommand saveCommand = new NCommand();
    saveCommand.Properties.Text = "Save";
    NCommand exitCommand = new NCommand();
    exitCommand.Properties.Text = "E&xit";
    NCommand saveAsCommand = new NCommand();
    saveAsCommand.Properties.Text = "&Save As";
    NCommand saveAllCommand = new NCommand();
    saveAllCommand.Properties.Text = "Save &All";
    Visual Basic
    Copy Code
    'create a NToolbar object first
    Dim toolbar As NToolbar = New NToolbar()
    toolbar.DefaultCommandStyle = CommandStyle.Text
    'create a file command and add it to the toolbar
    Dim fileCommand As NCommand = New NCommand()
    fileCommand.Properties.Text = "&File"
    fileCommand.Properties.ShowArrowStyle = ShowArrowStyle.Never
    'create some nested commands
    Dim saveCommand As NCommand = New NCommand()
    saveCommand.Properties.Text = "Save"
    Dim exitCommand As NCommand = New NCommand()
    exitCommand.Properties.Text = "E&xit"
    Dim saveAsCommand As NCommand = New NCommand()
    saveAsCommand.Properties.Text = "&Save As"
    Dim saveAllCommand As NCommand = New NCommand()
    saveAllCommand.Properties.Text = "Save &All"

    The result from the example code above. 

    See Also