Hi All,
In my blazor client-side app I'm using a SfDialog to show a Notification panel, it is opened on a top menu button click and I would like to close it when clicking outside de dialog area, I managed to do it by adding javascript code but it would be great to have an option included in the control so that it is all the functionality in the same place and easier to understand the code when it's read.
Is there a way to do it?
Thanks
Mario
|
<SfButton @onclick="@OpenDialog">Open Modal Dialog</SfButton>
<SfDialog Width="250px" IsModal="true" @bind-Visible="@IsVisible">
<DialogEvents OnOverlayClick="@OnOverlayclick">
</DialogEvents>
<DialogTemplates>
<Content> This is a modal dialog and it can be closed when clicking the overlay area </Content>
</DialogTemplates>
</SfDialog>
@code {
private bool IsVisible { get; set; } = true;
private void OpenDialog()
{
this.IsVisible = true;
}
private void OnOverlayclick(MouseEventArgs arg)
{
this.IsVisible = false;
}
}
|
Hi Vinitha,
Thank you for your response. Sorry, I meant to say SfToolip, as it is the one I'm using for my user account info when logged in.
Also, I have a notification panel made using another SFToolip, so for both of them, I would like to Close them when the other one is opened. Close on click outside will make it. Is there a way to do it?
<SfTooltip @ref="@NotificationTooltip" CssClass="notifications-tooltip" Position="Syncfusion.Blazor.Popups.Position.BottomRight" OpensOn="Click" IsSticky="true" ShowTipPointer="false">
<SfTooltip @ref="@Tooltip" CssClass="user-info-tooltip" Position="Syncfusion.Blazor.Popups.Position.BottomLeft" OpensOn="Click" ShowTipPointer="false">
Thanks again for the support.
Regards,
Mario
|
<div style="display:inline-flex">
<SfTooltip OnOpen="open" Target="#btn" Content="Welcome" @ref="@NotificationTooltip" CssClass="notifications-tooltip" Position="Syncfusion.Blazor.Popups.Position.BottomRight" OpensOn="Click" IsSticky="true" ShowTipPointer="false">
<SfButton Content="Tooltip 1" id="btn"></SfButton>
</SfTooltip>
<SfTooltip OnOpen="open1" @ref="@Tooltip" Target="#btn1" Content="Syncfusion" CssClass="user-info-tooltip" Position="Syncfusion.Blazor.Popups.Position.BottomRight" OpensOn="Click" ShowTipPointer="false">
<SfButton Content="Tooltip 2" id="btn1"></SfButton>
</SfTooltip>
</div>
@code {
public SfTooltip NotificationTooltip;
public SfTooltip Tooltip;
public void open(TooltipEventArgs args)
{
Tooltip.CloseAsync();
}
public void open1(TooltipEventArgs args)
{
NotificationTooltip.CloseAsync();
}
} |