Class ToastOpenArgs
Specifies the event arguments for the Toast open event.
Inheritance
Namespace: Syncfusion.Blazor.Notifications
Assembly: Syncfusion.Blazor.dll
Syntax
public class ToastOpenArgs : Object
Remarks
This class provides data for the event that is raised after a Toast notification has been successfully opened and displayed to the user. It contains information about the opened Toast, including its configuration and unique identifier.
Examples
<SfToast @ref="ToastRef">
<ToastEvents TValue="ToastModel" Opened="@OnToastOpened"></ToastEvents>
</SfToast>
private void OnToastOpened(ToastOpenArgs args)
{
// Log when toast is displayed
Console.WriteLine($"Toast with Key {args.Key} is now visible");
// Start tracking or analytics
if (args.Options?.Title == "Welcome")
{
TrackWelcomeMessageShown();
}
}
Constructors
ToastOpenArgs()
Declaration
public ToastOpenArgs()
Properties
Key
Gets or sets the unique identifier of the opened 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 opened. |
Remarks
The Key property uniquely identifies which Toast notification was opened, especially useful when multiple Toast messages are managed. This identifier can be used for tracking purposes, correlating the open event with other application logic, or managing Toast sequences. 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 opened Toast.
Declaration
public ToastModel Options { get; set; }
Property Value
Type | Description |
---|---|
ToastModel | An instance of ToastModel representing the configuration options for the opened Toast notification. Can be |
Remarks
This property provides access to the complete configuration of the Toast that was opened. You can use this information to perform tracking, analytics, or trigger additional actions based on the Toast's content, type, or other properties. This is particularly useful for understanding what content is being displayed to users and implementing responsive behaviors.