feat: add Content Attribute.

This commit is contained in:
Zhang Dian
2024-09-11 21:30:15 +08:00
parent 62a277cc16
commit 70d0f236d6
4 changed files with 10 additions and 2 deletions

View File

@@ -16,7 +16,9 @@
<u:Notification Content="Hello, Ursa!" /> <u:Notification Content="Hello, Ursa!" />
</u:NotificationCard> </u:NotificationCard>
<u:NotificationCard NotificationType="Error" Classes="Light"> <u:NotificationCard NotificationType="Error" Classes="Light">
<u:Notification Title="Welcome" Content="Hello, Ursa!" /> <u:Notification Title="Welcome">
Hello, Ursa!
</u:Notification>
</u:NotificationCard> </u:NotificationCard>
</ReversibleStackPanel> </ReversibleStackPanel>
</ThemeVariantScope> </ThemeVariantScope>

View File

@@ -10,7 +10,9 @@
Hello, Ursa! Hello, Ursa!
</u:ToastCard> </u:ToastCard>
<u:ToastCard NotificationType="Success" Classes="Light"> <u:ToastCard NotificationType="Success" Classes="Light">
<u:Toast Content="Hello, Ursa!" /> <u:Toast>
Hello, Ursa!
</u:Toast>
</u:ToastCard> </u:ToastCard>
</ReversibleStackPanel> </ReversibleStackPanel>
</ThemeVariantScope> </ThemeVariantScope>

View File

@@ -1,6 +1,7 @@
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Avalonia.Controls.Notifications; using Avalonia.Controls.Notifications;
using Avalonia.Metadata;
namespace Ursa.Controls; namespace Ursa.Controls;
@@ -66,6 +67,7 @@ public class Notification : INotification, INotifyPropertyChanged
} }
/// <inheritdoc/> /// <inheritdoc/>
[Content]
public string? Content public string? Content
{ {
get => _content; get => _content;

View File

@@ -1,6 +1,7 @@
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Avalonia.Controls.Notifications; using Avalonia.Controls.Notifications;
using Avalonia.Metadata;
namespace Ursa.Controls; namespace Ursa.Controls;
@@ -49,6 +50,7 @@ public class Toast : IToast, INotifyPropertyChanged
} }
/// <inheritdoc/> /// <inheritdoc/>
[Content]
public string? Content public string? Content
{ {
get => _content; get => _content;