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
TopLevelThe TopLevel that will host the control.
Fields
MaxItemsProperty
Defines the MaxItems property.
public static readonly StyledProperty<int> MaxItemsProperty
Field Value
PositionProperty
Defines the Position property.
public static readonly StyledProperty<NotificationPosition> PositionProperty
Field Value
Properties
MaxItems
Defines the maximum number of notifications visible at once.
public int MaxItems { get; set; }
Property Value
Position
Defines which corner of the screen notifications can be displayed in.
public NotificationPosition Position { get; set; }
Property Value
- See Also
Methods
Close(INotification)
Closes a notification.
public void Close(INotification notification)
Parameters
notification
INotificationThe notification to be closed.
Close(object)
Closes a notification.
public void Close(object content)
Parameters
content
objectThe 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
TemplateAppliedEventArgsThe event args.
OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
Called when the control is removed from a rooted visual tree.
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
Parameters
e
VisualTreeAttachmentEventArgsThe event args.
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe 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
objectThe 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
objectthe content of the notification
type
NotificationTypethe 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
Actionan Action to be run when the notification is clicked
onClose
Actionan Action to be run when the notification is closed
classes
string[]style classes to apply