Asp Boilerplate,,, How to create New Menu in Menu bar?

963 views Asked by At

I want to add a new menu in menu bar, i created a class according to Boilerplate documents, but don't know how to configure menu,, And menu is for all users,, Here is code which i have done yet I created a class extended from navigation provider

  public class NavigationsProviderMenu : NavigationProvider
{
    public override void SetNavigation(INavigationProviderContext context)
    {
        context.Manager.MainMenu
        .AddItem(
            new MenuItemDefinition(
                "Jobs",
                new LocalizableString("Jobs", "ShipperBuyerV1"),
                url: "/JobsList",
                icon: "fa fa-tasks"
                ));
    }

}
1

There are 1 answers

0
Slava Utesinov On BEST ANSWER

You should sequentially call AddItem as a chain and all corresponding menu items will be at same level:

context.Manager.MainMenu
    .AddItem(
        new MenuItemDefinition(
            "Jobs",
            new LocalizableString("Jobs", "ShipperBuyerV1"),
            url: "/JobsList",
            icon: "fa fa-tasks"
        ))
    .AddItem(
        new MenuItemDefinition(
            "Another",
            new LocalizableString("Another", "ShipperBuyerV1"),
            url: "/Another",
            icon: "fa fa-tasks"
        ));