Class MessageCloseEventArgs
Provides information about the Closed event.
Inheritance
Namespace: Syncfusion.Blazor.Notifications
Assembly: Syncfusion.Blazor.dll
Syntax
public class MessageCloseEventArgs : Object
Remarks
This class contains event arguments that are passed when a message component is closed. It helps distinguish between automatic closures and user-initiated closures, which can be useful for tracking user interactions and implementing custom logic based on the closure method.
Examples
The following example demonstrates how to use the MessageCloseEventArgs in a Closed event handler:
<SfMessage Closed="@OnMessageClosed">
Your message content here
</SfMessage>
@code {
private void OnMessageClosed(MessageCloseEventArgs args)
{
if (args.IsInteracted)
{
// User explicitly closed the message
Console.WriteLine("Message was closed by user interaction");
}
else
{
// Message was closed automatically (e.g., timeout)
Console.WriteLine("Message was closed automatically");
}
}
}
Constructors
MessageCloseEventArgs()
Declaration
public MessageCloseEventArgs()
Properties
IsInteracted
Gets or sets a value indicating whether the message close event was triggered by user interaction.
Declaration
public bool IsInteracted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property is essential for determining the cause of message closure. When true
, it indicates that the user
actively dismissed the message through direct interaction (clicking close button, pressing Escape key, etc.).
When false
, it indicates the message was closed automatically by the system (such as timeout expiration,
programmatic closure, or other non-interactive triggers). This distinction helps in implementing different behaviors
based on whether the closure was intentional user action or system-initiated.