Skip to main content

Notification Class

Definition

Assembly:Avalonia.Controls
Package:Avalonia

A notification that can be shown in a window or by the host operating system.

public class Notification

Inheritance: object -> Notification

Implements: INotification, INotifyPropertyChanged

Remarks

This class represents a notification that can be displayed either in a window using Avalonia.Controls.Notifications.WindowNotificationManager or by the host operating system (to be implemented).

Constructors

NameDescription
Notification (2 overloads)Initializes a new instance of the Avalonia.Controls.Notifications.Notification class.

Notification overloads

Notification Constructor

Initializes a new instance of the Avalonia.Controls.Notifications.Notification class.

public Notification()

Notification Constructor

public Notification(string title, string message, Avalonia.Controls.Notifications.NotificationType type, Nullable<TimeSpan> expiration, Action onClick, Action onClose)
Parameters

title string

message string

type Avalonia.Controls.Notifications.NotificationType

expiration Nullable<TimeSpan>

onClick Action

onClose Action

Properties

NameDescription
ExpirationGets the expiration time of the notification after which it will automatically close. If the value is TimeSpan.Zero then the notification will remain open until the user closes it.
MessageGets the notification message.
OnClickGets an Action to be run when the notification is clicked.
OnCloseGets an Action to be run when the notification is closed.
TitleGets the Title of the notification.
TypeGets the Avalonia.Controls.Notifications.NotificationType of the notification.

Expiration Property

Gets the expiration time of the notification after which it will automatically close. If the value is TimeSpan.Zero then the notification will remain open until the user closes it.

public TimeSpan Expiration { get; set; }

Message Property

Gets the notification message.

public string Message { get; set; }

OnClick Property

Gets an Action to be run when the notification is clicked.

public Action OnClick { get; set; }

OnClose Property

Gets an Action to be run when the notification is closed.

public Action OnClose { get; set; }

Title Property

Gets the Title of the notification.

public string Title { get; set; }

Type Property

Gets the Avalonia.Controls.Notifications.NotificationType of the notification.

public Avalonia.Controls.Notifications.NotificationType Type { get; set; }

Events

NameDescription
PropertyChangedNo summary available.

PropertyChanged Event

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged