ToastOptions.DisplayTime Property
Specifies how long the toast is visible.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[DefaultValue(null)]
public TimeSpan? DisplayTime { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Nullable<TimeSpan> | null | The time span; |
Remarks
Use the DisplayTime
property to specify the time span after which the toast disappears. If the property is not specified, the display time is determined by the DxToastProvider.DisplayTime property (5 seconds by default).
Set the DisplayTime
property to 0
(zero) to leave the message visible until it is forced closed.
<DxButton Text="Show a toast" Click="CreateToast" />
<DxButton Text="Close a toast" Click="CloseToast" />
<DxToastProvider />
@code {
[Inject] IToastNotificationService ToastService { get; set; }
private void CreateToast() {
ToastService.ShowToast(new ToastOptions {
Id="toast",
DisplayTime = @TimeSpan.Zero,
Title = "Notification",
Text = "The process is completed.",
});
}
private void CloseToast() {
ToastService.CloseToast("toast");
}
}
See Also