Toast Service - Existing Toast Gets Updated

Hi, I am relative new to Blazor and Syncfusion. I am have been impressed by the amount of information available to aid in my development. I followed the instructions on creating a toast service that activates component on the main layout. All is working. I have one question. 

If the service is asked to post a second toast whilst a toast is still visible w toasts are displayed however the first toast content is updated to the second toast content. Can this behaviour be stopped and the content of the first toast display locked? (Not updated) 

Regards,

Chad


1 Reply 1 reply marked as answer

VJ Vinitha Jeyakumar Syncfusion Team August 23, 2022 11:57 AM UTC

Hi Chad,

Your reported issue can be resolved by passing the ToastModel with the ShowAsync method of Toast control.

Code snippet:
ToastComponent.razor
protected override async Task OnInitializedAsync()
    {
        // Update the parameter in local variable and render the toast
        ToastService.ToastInstance += (ToastOptions options) =>
        {
            InvokeAsync(() =>
            {
               this.ToastObj.ShowAsync(new ToastModel() { Title = options.Title, Content = options.Content,CssClass=  options.CssClass });
            });
        };
    }


If this post is helpful, kindly consider accepting it as the solution so that other members can locate it more quickly.

Regards,
Vinitha

Marked as answer
Loader.
Up arrow icon