Table of Contents

Class WindowNotificationManager

Namespace
Avalonia.Controls.Notifications
Assembly
Avalonia.Controls.dll

An INotificationManager that displays notifications in a Window.

[TemplatePart("PART_Items", typeof(Panel))]
[PseudoClasses(new string[] { ":topleft", ":topright", ":bottomleft", ":bottomright", ":topcenter", ":bottomcenter" })]
public class WindowNotificationManager : TemplatedControl, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, IManagedNotificationManager, INotificationManager
Inheritance
WindowNotificationManager
Implements
Inherited Members
Extension Methods

Constructors

WindowNotificationManager()

Initializes a new instance of the WindowNotificationManager class.

public WindowNotificationManager()

WindowNotificationManager(TopLevel?)

Initializes a new instance of the WindowNotificationManager class.

public WindowNotificationManager(TopLevel? host)

Parameters

host TopLevel

The TopLevel that will host the control.

Fields

MaxItemsProperty

Defines the MaxItems property.

public static readonly StyledProperty<int> MaxItemsProperty

Field Value

StyledProperty<int>

PositionProperty

Defines the Position property.

public static readonly StyledProperty<NotificationPosition> PositionProperty

Field Value

StyledProperty<NotificationPosition>

Properties

MaxItems

Defines the maximum number of notifications visible at once.

public int MaxItems { get; set; }

Property Value

int

Position

Defines which corner of the screen notifications can be displayed in.

public NotificationPosition Position { get; set; }

Property Value

NotificationPosition
See Also

Methods

Close(INotification)

Closes a notification.

public void Close(INotification notification)

Parameters

notification INotification

The notification to be closed.

Close(object)

Closes a notification.

public void Close(object content)

Parameters

content object

The content to be closed.

CloseAll()

Closes all notifications.

public void CloseAll()

OnApplyTemplate(TemplateAppliedEventArgs)

Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.

protected override void OnApplyTemplate(TemplateAppliedEventArgs e)

Parameters

e TemplateAppliedEventArgs

The event args.

OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)

Called when the control is removed from a rooted visual tree.

protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)

Parameters

e VisualTreeAttachmentEventArgs

The event args.

OnPropertyChanged(AvaloniaPropertyChangedEventArgs)

Called when a avalonia property changes on the object.

protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)

Parameters

change AvaloniaPropertyChangedEventArgs

The property change details.

Show(INotification)

Show a notification.

public void Show(INotification content)

Parameters

content INotification

Show(object)

Shows a notification.

public void Show(object content)

Parameters

content object

The content to be displayed.

Show(object, NotificationType, TimeSpan?, Action?, Action?, string[]?)

Shows a Notification

public void Show(object content, NotificationType type, TimeSpan? expiration = null, Action? onClick = null, Action? onClose = null, string[]? classes = null)

Parameters

content object

the content of the notification

type NotificationType

the type of the notification

expiration TimeSpan?

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

onClick Action

an Action to be run when the notification is clicked

onClose Action

an Action to be run when the notification is closed

classes string[]

style classes to apply