Can I open DropDown Menu items from another button? View items by clicking elsewhere?

Can I open DropDown Menu items from another button? View items by clicking elsewhere?


1 Reply

YA YuvanShankar Arunagiri Syncfusion Team July 28, 2022 05:04 AM UTC

Hi Fernando,


We have validated your reported query and can achieve your requirement by using the Toggle method of the dropdown menu. Please refer the code snippet and API link.


API link:
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SplitButtons.SfDropDownButton.html#Syncfusion_Blazor_SplitButtons_SfDropDownButton_Toggle


@using Syncfusion.Blazor.SplitButtons

@using Syncfusion.Blazor.Buttons

 

<SfDropDownButton @ref="dropdownbtn" Content="Edit">

    <DropDownMenuItems>

        <DropDownMenuItem Text="Cut"></DropDownMenuItem>

        <DropDownMenuItem Text="Copy"></DropDownMenuItem>

        <DropDownMenuItem Text="Paste"></DropDownMenuItem>

    </DropDownMenuItems>

</SfDropDownButton>

 

<SfButton CssClass="e-primary" @onclick="OnOpen">Open</SfButton>

 

@code{

    private SfDropDownButton dropdownbtn;

    private void OnOpen()

    {

        dropdownbtn.Toggle();

    }

}


Could you please check the above code and get back to us, if you need any further assistance on this. 


Regards,

YuvanShankar A


Loader.
Up arrow icon