feat: redesign Banner.

This commit is contained in:
Zhang Dian
2024-12-10 18:54:30 +08:00
parent dac9656d17
commit a00b0d2110
4 changed files with 64 additions and 82 deletions

View File

@@ -1,7 +1,7 @@
using System.Collections.ObjectModel;
using Avalonia.Controls;
using Avalonia.Controls.Notifications;
using Avalonia.Markup.Xaml;
using CommunityToolkit.Mvvm.ComponentModel;
using Ursa.Demo.ViewModels;
namespace Ursa.Demo.Pages;
@@ -20,37 +20,9 @@ public partial class BannerDemo : UserControl
}
}
public class BannerDemoViewModel : ViewModelBase
public partial class BannerDemoViewModel : ViewModelBase
{
private ObservableCollection<NotificationType>? _types;
public ObservableCollection<NotificationType>? Types
{
get => _types;
set => SetProperty(ref _types, value);
}
private NotificationType _selectedType;
public NotificationType SelectedType
{
get => _selectedType;
set => SetProperty(ref _selectedType, value);
}
private bool _bordered;
public bool Bordered
{
get => _bordered;
set => SetProperty(ref _bordered, value);
}
public BannerDemoViewModel()
{
Types = new ObservableCollection<NotificationType>()
{
NotificationType.Information, NotificationType.Success, NotificationType.Warning, NotificationType.Error
};
}
[ObservableProperty] private NotificationType _selectedType;
[ObservableProperty] private bool _bordered;
[ObservableProperty] private bool _canClose;
}