Class ToastBeforeOpenArgs
Specifies the event arguments for the Toast before open event.
Inheritance
Namespace: Syncfusion.Blazor.Notifications
Assembly: Syncfusion.Blazor.dll
Syntax
public class ToastBeforeOpenArgs : Object
Remarks
This class provides data for the event that is raised before a Toast notification is displayed. It allows you to cancel the opening of the Toast or modify its options programmatically.
Examples
<SfToast @ref="ToastRef">
<ToastEvents TValue="ToastModel" OnOpen="@OnBeforeOpen"></ToastEvents>
</SfToast>
private void OnBeforeOpen(ToastBeforeOpenArgs args)
{
// Cancel opening based on some condition
if (SomeCondition)
{
args.Cancel = true;
}
// Modify toast options
if (args.Options != null)
{
args.Options.Content = "Modified content";
}
}
Constructors
ToastBeforeOpenArgs()
Declaration
public ToastBeforeOpenArgs()
Properties
Cancel
Gets or sets a value indicating whether the Toast opening should be cancelled.
Declaration
public bool Cancel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Setting this property to true
prevents the Toast from being displayed to the user.
This is useful for implementing conditional logic where certain Toast notifications should not appear based on application state or user preferences.
Options
Gets or sets the current Toast model properties as options.
Declaration
public ToastModel Options { get; set; }
Property Value
Type | Description |
---|---|
ToastModel | An instance of ToastModel representing the configuration options for the Toast notification. Can be |
Remarks
This property provides access to the Toast configuration that will be used when the Toast is displayed. You can modify these options programmatically before the Toast opens to customize its appearance, content, or behavior. Common modifications include changing the content, title, timeout duration, or CSS classes.