Class ToastModel
Represents a toast notification message.
public class ToastModel
- Inheritance
-
ToastModel
- Inherited Members
Constructors
ToastModel()
public ToastModel()
Properties
Color
Gets or sets the color theme of the toast.
public Color? Color { get; set; }
Property Value
CreatedAt
Gets or sets the timestamp when the toast was created.
public DateTime CreatedAt { get; set; }
Property Value
Duration
Gets or sets the duration in milliseconds before the toast auto-dismisses.
public int Duration { get; set; }
Property Value
Remarks
Set to 0 to disable auto-dismiss. Default is 5000ms (5 seconds).
ElapsedTimeText
Gets the elapsed time text for display.
public string ElapsedTimeText { get; }
Property Value
Icon
Gets or sets the icon to display in the toast.
public Icon? Icon { get; set; }
Property Value
- Icon?
Id
Gets or sets the unique identifier for the toast.
public Guid Id { get; set; }
Property Value
IsBurnt
Gets whether the toast has exceeded its display duration.
public bool IsBurnt { get; }
Property Value
Remarks
Always false while IsPaused, and time spent paused is excluded from the elapsed duration once resumed, so hovering/focusing a toast never counts against its lifetime.
IsFocused
Gets whether this toast (or a descendant, e.g. its close button) currently has keyboard focus.
public bool IsFocused { get; }
Property Value
IsHovered
Gets whether the pointer is currently hovering this toast.
public bool IsHovered { get; }
Property Value
IsPaused
Gets whether the toast's auto-dismiss timer is currently paused, i.e. because the pointer is hovering it, it has keyboard focus, or both.
public bool IsPaused { get; }
Property Value
Remarks
Hover and focus are tracked independently so that, e.g., moving the pointer away from a toast that still has keyboard focus (or vice versa) doesn't prematurely resume the auto-dismiss timer while the toast is still being interacted with.
Message
Gets or sets the message content of the toast.
public string Message { get; set; }
Property Value
Title
Gets or sets the title of the toast.
public string Title { get; set; }
Property Value
Methods
PauseForFocus()
Marks the toast as having keyboard focus, pausing its auto-dismiss timer.
public void PauseForFocus()
PauseForHover()
Marks the toast as hovered by the pointer, pausing its auto-dismiss timer.
public void PauseForHover()
ResumeForFocus()
Marks the toast as no longer having keyboard focus, resuming its auto-dismiss timer only if the pointer also isn't currently hovering it.
public void ResumeForFocus()
ResumeForHover()
Marks the toast as no longer hovered by the pointer, resuming its auto-dismiss timer only if it also doesn't currently have keyboard focus.
public void ResumeForHover()