Class Notification
- Namespace
- Avalonia.Controls.Notifications
- Assembly
- Avalonia.Controls.dll
A notification that can be shown in a window or by the host operating system.
public class Notification : INotification, INotifyPropertyChanged
- Inheritance
-
Notification
- Implements
- Inherited Members
Remarks
This class represents a notification that can be displayed either in a window using WindowNotificationManager or by the host operating system (to be implemented).
Constructors
Notification()
Initializes a new instance of the Notification class.
public Notification()
Notification(string?, string?, NotificationType, TimeSpan?, Action?, Action?)
Initializes a new instance of the Notification class.
public Notification(string? title, string? message, NotificationType type = NotificationType.Information, TimeSpan? expiration = null, Action? onClick = null, Action? onClose = null)
Parameters
title
stringThe title of the notification.
message
stringThe message to be displayed in the notification.
type
NotificationTypeThe NotificationType of the notification.
expiration
TimeSpan?The expiry time at which the notification will close. Use Zero for notifications that will remain open.
onClick
ActionAn Action to call when the notification is clicked.
onClose
ActionAn Action to call when the notification is closed.
Properties
Expiration
Gets the expiration time of the notification after which it will automatically close. If the value is Zero then the notification will remain open until the user closes it.
public TimeSpan Expiration { get; set; }
Property Value
Message
Gets the notification message.
public string? Message { get; set; }
Property Value
OnClick
Gets an Action to be run when the notification is clicked.
public Action? OnClick { get; set; }
Property Value
OnClose
Gets an Action to be run when the notification is closed.
public Action? OnClose { get; set; }
Property Value
Title
Gets the Title of the notification.
public string? Title { get; set; }
Property Value
Type
Gets the NotificationType of the notification.
public NotificationType Type { get; set; }
Property Value
Methods
OnPropertyChanged(string?)
protected virtual void OnPropertyChanged(string? propertyName = null)
Parameters
propertyName
string
Events
PropertyChanged
public event PropertyChangedEventHandler? PropertyChanged