feat: redesign Banner.
This commit is contained in:
@@ -13,28 +13,27 @@
|
||||
</Design.DataContext>
|
||||
<StackPanel Spacing="20">
|
||||
<Grid ColumnDefinitions="*, 300">
|
||||
<Grid Grid.Column="0">
|
||||
<Border Margin="20">
|
||||
<u:Banner
|
||||
Classes.Bordered="{Binding Bordered}"
|
||||
Content="This is the Demo of Ursa Banner. "
|
||||
Header="Welcome to Ursa"
|
||||
Type="{Binding SelectedType}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
<u:Banner
|
||||
Margin="20"
|
||||
Grid.Column="0"
|
||||
Classes.Bordered="{Binding Bordered}"
|
||||
CanClose="{Binding CanClose}"
|
||||
Content="This is the Demo of Ursa Banner. "
|
||||
Header="Welcome to Ursa"
|
||||
Type="{Binding SelectedType}" />
|
||||
<Border Grid.Column="1" VerticalAlignment="Top">
|
||||
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *">
|
||||
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *, *">
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Content="Type" />
|
||||
<ComboBox
|
||||
<u:EnumSelector
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
MinWidth="200"
|
||||
ItemsSource="{Binding Types}"
|
||||
SelectedItem="{Binding SelectedType}" />
|
||||
Width="200"
|
||||
EnumType="NotificationType"
|
||||
Value="{Binding SelectedType}" />
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
@@ -45,8 +44,18 @@
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding Bordered}" />
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Content="CanClose" />
|
||||
<ToggleSwitch
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding CanClose}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
</UserControl>
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user