feat: add default NotificationCard icon.
This commit is contained in:
parent
ce2e104286
commit
72f8d51eb1
@ -8,6 +8,7 @@
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<StackPanel HorizontalAlignment="Left" Spacing="20">
|
||||
<Button Click="InfoButton_OnClick" Content="Default" />
|
||||
<Button Click="InfoButton_OnClick" Content="Information" />
|
||||
<Button Click="InfoButton_OnClick" Content="Success" />
|
||||
<Button Click="InfoButton_OnClick" Content="Warning" />
|
||||
|
@ -2,17 +2,14 @@ using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
using Avalonia.Controls.Presenters;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.VisualTree;
|
||||
using Semi.Avalonia.Demo.Views;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Pages;
|
||||
|
||||
public partial class NotificationDemo : UserControl
|
||||
{
|
||||
private WindowNotificationManager? _manager;
|
||||
|
||||
public NotificationDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -22,14 +19,16 @@ public partial class NotificationDemo : UserControl
|
||||
{
|
||||
base.OnAttachedToVisualTree(e);
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
_manager = new WindowNotificationManager(topLevel){ MaxItems = 3};
|
||||
_manager = new WindowNotificationManager(topLevel) { MaxItems = 3 };
|
||||
}
|
||||
|
||||
private void InfoButton_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button b && b.Content is string s && Enum.TryParse<NotificationType>(s, out NotificationType t))
|
||||
if (sender is Button b && b.Content is string s)
|
||||
{
|
||||
_manager?.Show(new Notification(t.ToString(), "This is message", t));
|
||||
_manager?.Show(Enum.TryParse<NotificationType>(s, out NotificationType t)
|
||||
? new Notification(t.ToString(), "This is message", t)
|
||||
: new Notification(s, "This is message"));
|
||||
}
|
||||
}
|
||||
}
|
@ -37,7 +37,8 @@
|
||||
Height="16"
|
||||
Margin="16,16,12,0"
|
||||
VerticalAlignment="Top"
|
||||
IsVisible="False" />
|
||||
IsVisible="False"
|
||||
Data="{DynamicResource NotificationCardInformationIconPathData}"/>
|
||||
<ContentControl
|
||||
Name="PART_Content"
|
||||
MinHeight="64"
|
||||
|
Loading…
x
Reference in New Issue
Block a user