Hi Dulitha,
Thank you for
reaching out to Syncfusion Support.
We reviewed the reported issue,
and to programmatically close the dropdown button popup, you can use the toggle
method of the DropdownButton. The behavior of the toggle
method is such that if the popup is open and you call the method, it will
close, and if the popup is closed, it will open. You can utilize this method
based on your specific needs. Please refer to the below code snippets.
|
@using Syncfusion.Blazor.SplitButtons
@using Syncfusion.Blazor.Buttons
<SfDropDownButton @ref="DropDownButton"
Content="Edit">
<DropDownButtonEvents
OnClose="OnClose"></DropDownButtonEvents>
<DropDownMenuItems>
<DropDownMenuItem
Text="Cut"></DropDownMenuItem>
<DropDownMenuItem
Text="Copy"></DropDownMenuItem>
<DropDownMenuItem
Text="Paste"></DropDownMenuItem>
</DropDownMenuItems>
</SfDropDownButton>
<SfButton @onclick="OnClick">Close
popup</SfButton>
@code {
SfDropDownButton
DropDownButton;
private void
OnClose(BeforeOpenCloseMenuEventArgs args)
{
args.Cancel = true;
}
private void OnClick()
{
DropDownButton.Toggle();
}
}
|
Please
let us know if you need any further assistance on this.
Regards,
KeerthiKaran
K V