menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ToastCloseArgs - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ToastCloseArgs

    Specifies the event arguments for the Toast close event.

    Inheritance
    System.Object
    ToastCloseArgs
    Namespace: Syncfusion.Blazor.Notifications
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class ToastCloseArgs : Object
    Remarks

    This class provides data for the event that is raised after a Toast notification has been closed and removed from display. It contains information about the closed Toast, including its configuration and unique identifier.

    Examples
    <SfToast @ref="ToastRef">
        <ToastEvents TValue="ToastModel" Closed="@OnToastClosed"></ToastEvents>
    </SfToast>
    
    private void OnToastClosed(ToastCloseArgs args)
    {
        // Log the closed toast information
        Console.WriteLine($"Toast with Key {args.Key} has been closed");
    
        // Perform cleanup or follow-up actions
        if (args.Options?.Title == "Error")
        {
            LogErrorDismissal();
        }
    }

    Constructors

    ToastCloseArgs()

    Declaration
    public ToastCloseArgs()

    Properties

    Key

    Gets or sets the unique identifier of the closed Toast.

    Declaration
    public int Key { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer value representing the unique key of the Toast notification that was closed.

    Remarks

    The Key property uniquely identifies which Toast notification was closed, especially useful when multiple Toast messages are active. This identifier can be used for tracking purposes, cleanup operations, or correlating the close event with other application logic. Each Toast is assigned a unique key when it is created, and this key remains consistent throughout the Toast's lifecycle.

    Options

    Gets or sets the Toast model properties of the closed Toast.

    Declaration
    public ToastModel Options { get; set; }
    Property Value
    Type Description
    ToastModel

    An instance of ToastModel representing the configuration options for the closed Toast notification. Can be null.

    Remarks

    This property provides access to the complete configuration of the Toast that was closed. You can use this information to log details about the closed Toast, perform analytics tracking, or trigger follow-up actions based on the Toast's content, type, or other properties.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved