Table of Contents

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 string

The title of the notification.

message string

The message to be displayed in the notification.

type NotificationType

The NotificationType of the notification.

expiration TimeSpan?

The expiry time at which the notification will close. Use Zero for notifications that will remain open.

onClick Action

An Action to call when the notification is clicked.

onClose Action

An 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

TimeSpan

Message

Gets the notification message.

public string? Message { get; set; }

Property Value

string

OnClick

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

public Action? OnClick { get; set; }

Property Value

Action

OnClose

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

public Action? OnClose { get; set; }

Property Value

Action

Title

Gets the Title of the notification.

public string? Title { get; set; }

Property Value

string

Type

Gets the NotificationType of the notification.

public NotificationType Type { get; set; }

Property Value

NotificationType

Methods

OnPropertyChanged(string?)

protected virtual void OnPropertyChanged(string? propertyName = null)

Parameters

propertyName string

Events

PropertyChanged

public event PropertyChangedEventHandler? PropertyChanged

Event Type

PropertyChangedEventHandler