feat: add close button.

This commit is contained in:
Zhang Dian
2024-09-05 03:30:02 +08:00
parent f0b23e1bdf
commit f52d62f9f5
7 changed files with 76 additions and 34 deletions

View File

@@ -22,12 +22,14 @@ public class Toast : IToast, INotifyPropertyChanged
/// <param name="type">The <see cref="NotificationType"/> of the toast.</param>
/// <param name="expiration">The expiry time at which the toast will close.
/// Use <see cref="TimeSpan.Zero"/> for toasts that will remain open.</param>
/// <param name="showClose">A value indicating whether the toast should show a close button.</param>
/// <param name="onClick">An Action to call when the toast is clicked.</param>
/// <param name="onClose">An Action to call when the toast is closed.</param>
public Toast(
string? content,
NotificationType type = NotificationType.Information,
TimeSpan? expiration = null,
bool showClose = true,
Action? onClick = null,
Action? onClose = null)
{
@@ -62,6 +64,9 @@ public class Toast : IToast, INotifyPropertyChanged
/// <inheritdoc/>
public NotificationType Type { get; set; }
/// <inheritdoc/>
public bool ShowClose { get; set; }
/// <inheritdoc/>
public TimeSpan Expiration { get; set; }