Adding tooltip to menu bar

I am using menu bar to displayed a docked sidebar and I want to add tooltip to it. I tried adding title="@item.Text" but it still does not work. I have attached a sample.


Attachment: BlazorAppTest_f1dc3861.zip


9 Replies 1 reply marked as answer

JS Janakiraman Sakthivel Syncfusion Team March 31, 2022 05:28 PM UTC

Hi Nick,


We are currently validating your reported query, so we will update you with further details by April 4th, 2022.


Regards,

Janakiraman S.



NI Nick replied to Janakiraman Sakthivel April 8, 2022 01:43 PM UTC

Hi, 

When can I expect a reply to this?



SD Saranya Dhayalan Syncfusion Team April 9, 2022 02:43 AM UTC

Hi Nick,


Sorry for the delay.


We have checked your sample and in that you have used Items property as well as MenuItems   tag directive to render Menu component which causes this issue. So, we have removed the Items property and used TValue to resolve this issue. Please find the code snippet below,


<SfMenuTValue="MenuItem"CssClass="dock-menu"Orientation="@VerOrientation">

      <MenuItems>

           @foreach (var item in MainMenuItems)

           {

                <MenuItemText="@item.Text"IconCss="@item.IconCss"Url="@item.Url" title="@item.Text"></MenuItem>

           }

       </MenuItems>

</SfMenu>


Please check and get back to us if you need further assistance on this.


Regards,

Saranya D



NI Nick replied to Saranya Dhayalan April 12, 2022 12:52 PM UTC

Doing this prevents the sub-menu item from being loaded after docking.



TS Thaneegairaj Sankar Syncfusion Team April 18, 2022 02:15 PM UTC

Hi Nick,


We have checked your sample and in that you need to add tag directive for sub items. Please find the code snippet below,


<SfMenu TValue="MenuItem" CssClass="dock-menu" Orientation="@VerOrientation">

<MenuItems>

@foreach (var item in MainMenuItems)

{

<MenuItem Text="@item.Text" IconCss="@item.IconCss" Url="@item.Url" title="@item.Text">

@if (item.Items != null)

{

<MenuItems>

@foreach (var item1 in item.Items)

{

<MenuItem Text="@item1.Text" IconCss="@item1.IconCss" Url="@item1.Url" title="@item1.Text"></MenuItem>

}

</MenuItems>

}

</MenuItem>

}

</MenuItems>

</SfMenu>



Please check and get back to us if you need further assistance on this.


Regards,

Thaneegairaj S


Marked as answer

WM Walter Martin November 2, 2023 02:22 PM UTC

How can I add the tooltip from code behind ?

I'm adding the menuitems programmatically but I don't find a way to add the tooltip




KV Keerthikaran Venkatachalam Syncfusion Team November 4, 2023 02:53 PM UTC

Hi Walter Martin,


We have checked your reported query and prepared a sample based on your requirements. In Button Click, we have changed the menu item dynamically. Please refer to the code snippet and sample below.


<SfMenu TValue="MenuItem" CssClass="dock-menu">

    <MenuItems>

        @foreach (var item in MainMenuItems)

        {

            <MenuItem Text="@item.Text" title="@item.Text">

                @if (item.Items != null)

                {

                    <MenuItems>

                        @foreach (var item1 in item.Items)

                        {

                            <MenuItem Text="@item1.Text" title="@item1.Text"></MenuItem>

                        }

                    </MenuItems>

                }

            </MenuItem>

        }

    </MenuItems>

</SfMenu>

<SfButton @onclick="onclick">Change Item Dynamically</SfButton>

 

@code {

    public class MenuItemModel

    {

        public List<MenuItemModel> Items { get; set; }

        public string Text { get; set; }

    }

    public List<MenuItemModel> MainMenuItems = new List<MenuItemModel>{

        new MenuItemModel { Text = "Align" , Items = new List<MenuItemModel> {

                new MenuItemModel { Text="Left" },

                new MenuItemModel { Text="Right" },

                new MenuItemModel { Text="Center" },

                new MenuItemModel { Text="Top"},

                new MenuItemModel { Text="Bottom" },

                new MenuItemModel { Text="Middle"}

            }},

        new MenuItemModel { Text = "Open" },

        new MenuItemModel { Text = "Export"},

        new MenuItemModel { Text = "Print" }

    };

    private void onclick()

    {

        MainMenuItems = new List<MenuItemModel> {

            new MenuItemModel { Text = "File" , Items = new List<MenuItemModel> {

                    new MenuItemModel { Text="Open" },

                    new MenuItemModel { Text="Save" },

                    new MenuItemModel { Text="Exit" }

                }},

            new MenuItemModel { Text = "Tools" },

            new MenuItemModel { Text = "Customize"},

            new MenuItemModel { Text = "Help" }

       };

    }

}


Sample link: https://blazorplayground.syncfusion.com/VZLgiitzegSunOId 


Please let us know if you need any further assistance on this.


Regards,

KeerthiKaran K V



WM Walter Martin November 14, 2023 09:02 PM UTC

many thanks for your help

it works perfectly



KV Keerthikaran Venkatachalam Syncfusion Team November 15, 2023 03:04 AM UTC

You're welcome, Walter Martin. Get back to us if you need any other assistance.


NOTE: If that post is helpful, please mark it as an answer so that other members can locate it more quickly.


Loader.
Up arrow icon