Menu bar functionally and visually similar to the Menu bar created with Bootstrap, using Menu bar c.

I am trying to achieve professional look of menu bar in Blazor using Menu bar control. I pass all your examples with menu bar but did not find some one where look,  and behaviors are like at list bootstrap navbar. The most problem is in visual appearance. If I mix different css, than result is not enough good. For example I would like to mimic in blazor app apple.com basic navbar, or yours syncfusion navbar or at list bootstrap navbar for different displays.
Probably someone else already did it.
Regards Igor


16 Replies 1 reply marked as answer

MK Mohan Kumar Ramasamy Syncfusion Team November 17, 2020 05:37 PM UTC

 Hi Igor, 
 
We have checked your reported query. We can achieve your requirement using CSS style property. Please refer below code snippets. 
 
 
@using Syncfusion.Blazor.Navigations 
 
<div class="control-section"> 
    <div class="menu-control"> 
        <SfMenu TValue="MenuItem" CssClass="e-custom"> 
            <MenuItems> 
                <MenuItem Text="Mac" Url="/Mac"></MenuItem> 
                <MenuItem Text="iPad" Url="/iPad"></MenuItem> 
                <MenuItem Text="iPhone" Url="/iPhone"></MenuItem> 
                <MenuItem Text="Watch" Url="/Watch"></MenuItem> 
                <MenuItem Text="TV" Url="TV"></MenuItem> 
                <MenuItem Text="Music" Url="/Music"></MenuItem> 
                <MenuItem Text="Support" Url="/Support"></MenuItem> 
            </MenuItems> 
        </SfMenu> 
    </div> 
</div> 
<style> 
    .e-menu-container.e-custom ul a.e-menu-text.e-menu-url { 
        font-size: 14px; 
        font-weight: 400; 
        letter-spacing: -.01em; 
        font-family: "SF Pro Text","Myriad Set Pro","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif; 
        color: #f5f5f7; 
        padding: 0 10px; 
        height: 44px; 
        opacity: .8; 
        transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); 
    } 
 
    .main, .e-menu-container ul { 
        background-color: rgba(0,0,0,0.8); 
    } 
 
    .e-menu-container.e-custom ul li.e-focused a.e-menu-text.e-menu-url { 
        color: #EFF; 
        outline: 0 solid #f2f4f6; 
    } 
    .main { 
        height:968px; 
    } 
    .menu-control { 
        background-color: rgba(0,0,0,0.8); 
        text-align: center; 
        line-height:0.5; 
    } 
</style> 
 
 
For your reference we have prepared a sample based on this, please refer below sample link. 
 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Mohan kumar R 


Marked as answer

IG Igor November 17, 2020 10:33 PM UTC

Mohan that looks great. Thanks a lot.

Only one more thing. 
In case HamburgerMode="true"
Togler icon is to dark (see image), also there is text Menu (also very dark). Text "Menu" is probably equivalent for class="navbar-brand" .
Where I can define text for navbar-brand (let say Igor enstead Menu text) and what css class is responsible for color (visibility) of  hamburger menu.
If dark text Menu mean's navbar-brand how it could be visible all the time, not only when hamburger is visible.

How you predict to change visibility of HamburgerMode. One way is to add java script and read media size (browser size), and change value false to true for different display resolutions.  Does exist more elegant solution? css class? What is your suggestion?

Regards Igor






Attachment: HamburgerMode_d697f12f.zip


MK Mohan Kumar Ramasamy Syncfusion Team November 18, 2020 07:24 AM UTC

Hi Igor, 
 
Thanks for update. 
 
We have checked your reported query. We have resolved HamburgerMode styles issue. And we can bind resize event script side and change the HamburgerMode in Menu component. Please refer below code snippets. 
Index.razor 
 
@using Syncfusion.Blazor.Navigations 
@inject IJSRuntime JSRuntime; 
 
<div class="control-section"> 
    <div class="menu-control"> 
        <SfMenu TValue="MenuItem" CssClass="e-custom" HamburgerMode="@hamburgerMode"> 
            <MenuItems> 
                <MenuItem Text="Mac" Url="/Mac"></MenuItem> 
                <MenuItem Text="iPad" Url="/iPad"></MenuItem> 
                <MenuItem Text="iPhone" Url="/iPhone"></MenuItem> 
                <MenuItem Text="Watch" Url="/Watch"></MenuItem> 
                <MenuItem Text="TV" Url="TV"></MenuItem> 
                <MenuItem Text="Music" Url="/Music"></MenuItem> 
                <MenuItem Text="Support" Url="/Support"></MenuItem> 
            </MenuItems> 
            <MenuEvents TValue="MenuItem" Created="Created"></MenuEvents> 
        </SfMenu> 
    </div> 
</div> 
@code { 
    private bool hamburgerMode; 
    private static Action<double> action; 
 
    private async Task Created() 
    { 
        action = ResizeHandler; 
        var width = await JSRuntime.InvokeAsync<double?>("registerResizeCallback", null); 
        ResizeHandler((double)width); 
    } 
 
    [JSInvokable] 
    public static void OnBrowserResize(double width) => action.Invoke(width); 
 
    private void ResizeHandler(double width) 
    { 
        if (width < 600) //Menu will be changed to hamburger mode, when the screen size is less than 600. 
        { 
            if (!hamburgerMode) 
            { 
                hamburgerMode = true; 
                StateHasChanged(); 
            } 
        } 
        else 
        { 
            if (hamburgerMode) 
            { 
                hamburgerMode = false; 
                StateHasChanged(); 
            } 
        } 
    } 
} 
<style> 
    .e-menu-container.e-custom ul a.e-menu-text.e-menu-url { 
        font-size: 14px; 
        font-weight: 400; 
        letter-spacing: -.01em; 
        font-family: "SF Pro Text","Myriad Set Pro","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif; 
        color: #f5f5f7; 
        padding: 0 10px; 
        height: 44px; 
        opacity: .8; 
        transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); 
    } 
// hamburgerMode Styles issue resolved 
 
    .e-menu-container.e-custom.e-hamburger .e-menu-header .e-menu-icon, 
    .e-menu-container.e-custom.e-hamburger .e-menu-header { 
        color: #f5f5f7; 
    } 
 
    .main, .e-menu-container ul { 
        background-color: rgba(0,0,0,0.8); 
    } 
 
    .e-menu-container.e-custom ul li.e-focused a.e-menu-text.e-menu-url { 
        color: #EFF; 
        outline: 0 solid #f2f4f6; 
    } 
 
    .main { 
        height: 968px; 
    } 
 
    .menu-control { 
        background-color: rgba(0,0,0,0.8); 
        text-align: center; 
        line-height: 0.5; 
    } 
</style> 
 
 
_Host.cshtml 
 
<script> 
        window.registerResizeCallback = function () { 
            window.addEventListener('resize', resized); 
            return window.innerWidth; 
        } 
        window.resized = function () { 
            DotNet.invokeMethodAsync('BlazorApp-ServerSide', 'OnBrowserResize', window.innerWidth); 
        } 
    </script> 
 
For your reference, we have prepared a sample based on this. Please refer below link. 
 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Mohan kumar R 



IG Igor November 18, 2020 10:48 AM UTC

Mohan yes that's it about color of hamburger and appearance. Thank you.

You overlooked part of my previous question. 
Where I can change text Menu in something else (see picture)? Can this text be assumed as brand tag in bootstrap? Can I replace it with brand picture? Can I change font? 

regards Igor


Attachment: HamburgerMode2_2b20bd2d.zip


MK Mohan Kumar Ramasamy Syncfusion Team November 18, 2020 04:38 PM UTC

Hi Igor, 
 
Sorry for the inconvenience caused. 
 
We can set the Menu text using Title property. Please refer below code snippets. 
 
 
<SfMenu TValue="MenuItem" CssClass="e-custom" HamburgerMode="@hamburgerMode" Title="Apple"> 
            <MenuItems> 
                <MenuItem Text="Mac" Url="/Mac"></MenuItem> 
                <MenuItem Text="iPad" Url="/iPad"></MenuItem> 
                <MenuItem Text="iPhone" Url="/iPhone"></MenuItem> 
                <MenuItem Text="Watch" Url="/Watch"></MenuItem> 
                <MenuItem Text="TV" Url="TV"></MenuItem> 
                <MenuItem Text="Music" Url="/Music"></MenuItem> 
                <MenuItem Text="Support" Url="/Support"></MenuItem> 
            </MenuItems> 
            <MenuEvents TValue="MenuItem" Created="Created"></MenuEvents> 
        </SfMenu> 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Mohan kumar R  



IG Igor November 18, 2020 09:21 PM UTC

Hi Mohan, thank you for answer. That's it. 

Thank you. I will close this thread.

Regards Igor



IG Igor November 18, 2020 11:43 PM UTC

Mohan just one more question.
How to change text color of added submenus. See pictures. Now it is white but for submenu where background is white text should be black.

Here is my modified menu code

div class="control-section">
    <div class="menu-control">
        <SfMenu TValue="MenuItem" CssClass="e-custom" HamburgerMode="@hamburgerMode" Title="Metric" >
            <MenuItems>
                <MenuItem Text="Mac" Url="/Mac"></MenuItem>
                    <MenuItem Text="iPad" Url="/iPad"></MenuItem>
                    <MenuItem Text="iPhone" Url="/iPhone"></MenuItem>
                    <MenuItem Text="Watch" Url="/Watch"></MenuItem>
                    <MenuItem Text="TV" Url="TV"></MenuItem>
                    <MenuItem Text="Music" Url="/Music"></MenuItem>
                    <MenuItem Text="Support" Url="/Support">
                       
                        <MenuItems>
                            <MenuItem Text="iPad" Url="/iPad"></MenuItem>
                            <MenuItem Text="iPhone" Url="/iPhone"></MenuItem>
                        </MenuItems>

                    </MenuItem>

            </MenuItems>
            <MenuEvents TValue="MenuItem" Created="Created"></MenuEvents>
        </SfMenu>
    </div>
</div>

It should be in css. Can you help please.

Regards Igor


Attachment: menudropdownfontcolor_c2f6bbf0.zip


MK Mohan Kumar Ramasamy Syncfusion Team November 19, 2020 06:53 AM UTC

Hi Igor, 
 
Thanks for update. We can achieve your requirement using CSS style. Please refer below code snippets. 
 
 
<style> 
 
    .e-menu-container.e-custom ul .e-menu-item .e-caret { 
        color: #f5f5f7; 
    } 
    .e-menu-container.e-menu-popup { 
        background-color: rgba(0,0,0,0.8); 
    } 
 
    .e-menu-container.e-custom.e-menu-popup ul a.e-menu-text.e-menu-url { 
        color: #f5f5f7; 
    } 
 
    .e-menu-container.e-custom .e-menu-popup ul li.e-focused a.e-menu-text.e-menu-url, 
    .e-menu-container.e-custom.e-menu-popup ul li.e-focused a.e-menu-text.e-menu-url { 
        color: rgba(0,0,0,0.8); 
    } 
    .e-menu-container.e-custom ul a.e-menu-text.e-menu-url { 
        font-size: 14px; 
        font-weight: 400; 
        letter-spacing: -.01em; 
        font-family: "SF Pro Text","Myriad Set Pro","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif; 
        color: #f5f5f7; 
        padding: 0 10px; 
        height: 44px; 
        opacity: .8; 
        transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); 
    } 
 
    .e-menu-container.e-custom.e-hamburger .e-menu-header .e-menu-icon, 
    .e-menu-container.e-custom.e-hamburger .e-menu-header { 
        color: #f5f5f7; 
    } 
 
    .main, .e-menu-container ul { 
        background-color: rgba(0,0,0,0.8); 
    } 
 
    .e-menu-container.e-custom ul li.e-focused a.e-menu-text.e-menu-url { 
        color: #EFF; 
        outline: 0 solid #f2f4f6; 
    } 
 
    .main { 
        height: 968px; 
    } 
 
    .menu-control { 
        background-color: rgba(0,0,0,0.8); 
        text-align: center; 
        line-height: 0.5; 
    } 
</style> 
 
 
We can customize the highlight sub menu items using CSS styles. Please refer the below table. 
 
.e-menu-container.e-custom ul a.e-menu-text.e-menu-url, 
.e-menu-container.e-custom ul .e-menu-item .e-caret 
 
Customize root menu items 
.e-menu-container.e-custom.e-menu-popup ul a.e-menu-text.e-menu-url, 
.e-menu-container.e-menu-popup 
 
Customize sub menu items 
.e-menu-container.e-custom .e-menu-popup ul li.e-focused a.e-menu-text.e-menu-url, 
 
    .e-menu-container.e-custom.e-menu-popup ul li.e-focused a.e-menu-text.e-menu-url 
 
Customize highlighted sub menu items 
.e-menu-container .e-ul .e-menu-item.e-selected, 
.e-menu-container .e-ul .e-menu-item.e-selected .e-caret 
  
 
Customize selected sub menu items 
 
For your reference, we have prepared a sample based on this. Please refer below link. 
 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Mohan kumar R 



IG Igor November 19, 2020 10:45 AM UTC

Thank you Mohan for answer, thanks also for list of responsible css for menu.

Best regards
Igor


MK Mohan Kumar Ramasamy Syncfusion Team November 20, 2020 06:15 AM UTC

Hi Igor,   
  
Thanks for the update.  
 
We are happy to hear that your requirement has been fulfilled. Please feel free to contact us if you need any further assistance on this. 
 
Regards, 
Mohan kumar R 



IG Igor November 21, 2020 07:59 PM UTC

Hi Mohan as I am working new questions rose.
I adjusted css and layout. All works well but few things left.

1. Is possible that Title is all time visible? Not only when hamburger icon is visible.

2. Is possible to have png or icon for Title?

3. When hamburger is visible and pressed menu down is transparent. How to make it non transparent?

4. How to change hamburger icon with x icon when hamburger is pressed and menu is visible? 

5. When hamburger is pressed how to add white lines between menus for better distinction.

6. How, when hamburger is visible, change vertical size of menu-control to 48px. When hamburger is not visible vertical size should be 44px as now it is.

Regards Igor


MK Mohan Kumar Ramasamy Syncfusion Team November 24, 2020 08:42 AM UTC

Hi Igor, 
 
We have checked your reported query. We can achieve your requirement using CSS style.  
 
Query 1:  Is possible that Title is all time visible?  
 
 The Title is visible only hamburger mode as true. 
 
Query 2:  Is possible to have png or icon for Title?  
 
Yes, you can set icon instead of Title using CSS style. Please refer below code snippets. 
 
<SfMenu TValue="MenuItem" CssClass="e-custom" HamburgerMode="@hamburgerMode" Title=""> 
---- 
  </SfMenu> 
 
<style> 
    .e-menu-title:before { 
        content: '\e7e2'; 
    } 
        .e-menu-title { 
        font-size: 18px; 
        font-family: 'e-icons'; 
        font-style: normal; 
        font-variant: normal; 
        font-weight: normal; 
        line-height: 1; 
        text-transform: none; 
padding-left: 40px;  // you can adjust the icon space  
    } 
</style> 
 
 
 
Query 3:  When hamburger is visible and pressed menu down is transparent. How to make it non transparent? 
 
Could you please share your exact use case scenario for menu component. So that we can sort out and provide you the better solution quickly. 
 
Query 4:  How to change hamburger icon with x icon when hamburger is pressed and menu is visible?  
 
Yes, you can change hamburger icon using CSS style. We can dynamically change the X icon using OpOpen and Closed event. Please refer below code snippets. 
 
 
<SfMenu TValue="MenuItem" CssClass="e-custom" HamburgerMode="@hamburgerMode" Title=""> 
--------------------------- 
            <MenuEvents TValue="MenuItem" Created="Created" OnOpen="BeforeOpenMenu" Closed="CloseMenu"></MenuEvents> 
        </SfMenu> 
 
@code { 
private string content = "e7cd"; // Menu icon 
private void BeforeOpenMenu(BeforeOpenCloseMenuEventArgs<MenuItem> args) 
    { 
        if (args.ParentItem==null) 
        { 
            content = "e745"; // X icon 
        } 
    } 
 
    private void CloseMenu(OpenCloseMenuEventArgs<MenuItem> args) 
    { 
        if (args.ParentItem == null) 
        { 
            content = "e7cd"; //Menu icon 
        } 
    } 
} 
 
<style> 
    
    .e-menu-container.e-hamburger .e-menu-header .e-menu-icon::before { 
        content: '\@content'; 
    } 
</style> 
 
 
 
Query 5:  When hamburger is pressed how to add white lines between menus for better distinction. 
 
Yes, you can add white lines using CSS style. Please refer below code snippets. 
 
 
<style> 
    
    .e-menu-container.e-hamburger ul.e-menu-parent .e-menu-item .e-menu-text, 
    .e-menu-container.e-hamburger ul.e-menu-parent .e-menu-item .e-menu-container.e-menu-popup .e-menu-text { 
        border-bottom: 1px solid #fff; 
    } 
 
    .e-menu-container.e-hamburger ul.e-menu-parent li.e-menu-item:last-child .e-menu-text { 
        border-bottom: none; 
    }</style> 
 
 
 
Query 6:  How, when hamburger is visible, change vertical size of menu-control to 48px. When hamburger is not visible vertical size should be 44px as now it is. 
 
We have checked your reported scenario, we are unable to reproduce the reported issue in our end. Please refer below code snippets. 
 
 
<style> 
 
  .e-menu-container.e-custom ul a.e-menu-text.e-menu-url { 
        font-size: 14px; 
        font-weight: 400; 
        letter-spacing: -.01em; 
        font-family: "SF Pro Text","Myriad Set Pro","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif; 
        color: #f5f5f7; 
        padding: 0 10px; 
        height: 48px; 
        opacity: .8; 
        transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); 
    } 
</style> 
 
 
For your reference, we have prepared a sample based on this. Please refer below link. 
 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Mohan kumar R 



IG Igor March 16, 2021 09:09 PM UTC

Hi, I am back on menu we discussed before.

The problem is that menu does not collapse after menu item was selected. As you can see in video page (body) was loaded correctly but menu stay visible, should be close after successful select. 

Here is relevant code:

@using Syncfusion.Blazor.Navigations
@inject IJSRuntime JSRuntime;

<div class="control-section">
    <div class="menu-control">
        <SfMenu TValue="MenuItem" CssClass="e-custom" HamburgerMode="@hamburgerMode" Title="Metric">
            <MenuItems>
                <MenuItem Text="Metric" Url="/"></MenuItem>
                @*<MenuItem Text="Home" Url="/"></MenuItem>*@
                <MenuItem Text="Products" Url="/">
                    <MenuItems>
                        <MenuItem Text="Web Reporting" Url="/Reporting"></MenuItem>
                        <MenuItem Text="ERP" Url="/iPhone"></MenuItem>
                    </MenuItems>
                </MenuItem>
                    <MenuItems>
                        <MenuItem Text="About Us" Url="/Aboutus"></MenuItem>
                    </MenuItems>
                </MenuItem>
            </MenuItems>
            <MenuEvents TValue="MenuItem" Created="Created" OnOpen="BeforeOpenMenu" Closed="CloseMenu" ItemSelected="SelectHandler"></MenuEvents>
        </SfMenu>
    </div>
</div>

@code {
    private bool hamburgerMode;
    private static Action<double> action;
    private string content = "e7cd";


    private async Task Created()
    {
        action = ResizeHandler;
        var width = await JSRuntime.InvokeAsync<double?>("registerResizeCallback", null);
        ResizeHandler((double)width);
    }

    private void SelectHandler(MenuEventArgs<MenuItem> e)
    {
        string id = e.Item.Id;
       
    }

    private void BeforeOpenMenu(BeforeOpenCloseMenuEventArgs<MenuItem> args)
    {
        if (args.ParentItem == null)
        {
            content = "e745";

            StateHasChanged();
        }
    }

    private void CloseMenu(OpenCloseMenuEventArgs<MenuItem> args)
    {
        if (args.ParentItem == null)

        {
            content = "e7cd";

            StateHasChanged();
        }

    }



    [JSInvokable]
    public static void OnBrowserResize(double width) => action.Invoke(width);

    private void ResizeHandler(double width)
    {
        if (width < 600) //Menu will be changed to hamburger mode, when the screen size is less than 600.
        {
            if (!hamburgerMode)
            {
                hamburgerMode = true;
                StateHasChanged();
            }
        }
        else
        {
            if (hamburgerMode)
            {
                hamburgerMode = false;
                content = "e7cd";
                StateHasChanged();
            }
        }
    }
}
<style>
    .e-menu  {
        z-index: 2;
    }

         .e-menu-container.e-hamburger .e-menu-header .e-menu-icon::before {
            content: '\@content';
        }

         /*white lines betwen menus*/
    .e-menu-container.e-hamburger ul.e-menu-parent .e-menu-item .e-menu-text,
    .e-menu-container.e-hamburger ul.e-menu-parent .e-menu-item .e-menu-container.e-menu-popup .e-menu-text {
        border-bottom: 1px solid #fff;
    }

    .e-menu-container.e-hamburger ul.e-menu-parent li.e-menu-item:last-child .e-menu-text {
        border-bottom: none;
    }

   
    .e-menu-title {
        font-size: 18px;
         /*font-family: 'e-icons';*/
        font-variant: normal;
        font-weight: normal;
        line-height: 1;
        text-transform: none;
        padding-left: 40px;
      
    }

    /*dole je stari style bez crta*/



        .e-menu-container.e-custom ul .e-menu-item .e-caret {
            color: #f5f5f7;

        }

        .e-menu-container.e-menu-popup {
            background-color: rgba(0,0,0,1);

        }

        .e-menu-container.e-custom.e-menu-popup ul a.e-menu-text.e-menu-url {
            color: #f5f5f7;

        }

        .e-menu-container.e-custom .e-menu-popup ul li.e-focused a.e-menu-text.e-menu-url,
        .e-menu-container.e-custom.e-menu-popup ul li.e-focused a.e-menu-text.e-menu-url {
            color: rgba(0,0,0,1);

        }

        .e-menu-container.e-custom ul a.e-menu-text.e-menu-url {
            font-size: 14px;
            font-weight: 400;
            letter-spacing: -.01em;
            font-family: "SF Pro Text","Myriad Set Pro","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif;
            color: #f5f5f7;
            padding: 0 10px;
            height: 44px;
            opacity: .8;
            transition: opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);

        }

        .e-menu-container.e-custom.e-hamburger .e-menu-header .e-menu-icon,
        .e-menu-container.e-custom.e-hamburger .e-menu-header {
            color: #f5f5f7;
        }

        .e-menu-wrapper.e-hamburger ul.e-menu:not(.e-vertical), .e-menu-container.e-hamburger ul.e-menu:not(.e-vertical) {
            padding-top: 10px;
        }

            /* .e-menu-container  igor to keep background .main white*/
            .e-menu-container ul {
            background-color: rgba(0,0,0,0.8);

        }

        .e-menu-container.e-custom ul li.e-focused a.e-menu-text.e-menu-url {
            color: #EFF;
            outline: 0 solid #f2f4f6;

        }

        .main {
            height: 968px;
               }

    .menu-control {
        /*background-color: rgba(0,0,0,0.8);*/
        background-color: rgba(0,0,0,1);
        text-align: center;
        line-height: 0.5;
         padding-top: 8px;
        height: 44px;
    }





Attachment: SyncfusionMenuBarNotClose_f0a698b7.zip


GK Gayathri KarunaiAnandam Syncfusion Team March 17, 2021 12:35 PM UTC

Hi Igor, 
 
We have checked your reported query. We can close the Menu if it is opened in hamburger mode by using the Close method. Please check the below code snippet. 
 
Index.razor 
 
<SfMenu TValue="MenuItem" CssClass="e-custom" HamburgerMode="@hamburgerMode" Title="Metric" @ref="MenuObj"> 
            <MenuItems> 
                <MenuItem Text="Metric" Url="/"></MenuItem> 
                <MenuItem Text="Products" Url="/"> 
                    <MenuItems> 
                        <MenuItem Text="Web Reporting" Url="/Reporting"></MenuItem> 
                        <MenuItem Text="ERP" Url="/iPhone"></MenuItem> 
                    </MenuItems> 
                </MenuItem> 
                    <MenuItem> 
                        <MenuItem Text="About Us" Url="/Aboutus"></MenuItem> 
                    </MenuItem> 
               
            </MenuItems> 
            <MenuEvents TValue="MenuItem" Created="Created" OnOpen="BeforeOpenMenu" Closed="CloseMenu" ItemSelected="SelectHandler"></MenuEvents> 
        </SfMenu> 
 
@code { 
private void SelectHandler(MenuEventArgs<MenuItem> e) 
    { 
        if(e.Item.Items == null) 
        { 
            MenuObj.Close(); 
        } 
 
    } 
} 
 
For your reference, we have prepared a sample based on this. Please refer below link. 
 
 
Please get back to us, if you need further assistance. 
 
Regards, 
Gayathri K 



IG Igor March 17, 2021 03:38 PM UTC

Thank you very much,
yes that's what I am looking for.

Best regards Igor




GK Gayathri KarunaiAnandam Syncfusion Team March 18, 2021 05:09 AM UTC

 Hi Igor, 

Thanks for the update. 

We are happy to hear that your requirement has been fulfilled. Please feel free to contact us if you need any further assistance on this. 

Regards, 
Gayathri K 


Loader.
Up arrow icon