feat: redesign banner demo.

This commit is contained in:
Zhang Dian
2025-01-09 18:22:40 +08:00
parent 5d01f1ab6f
commit 954ca442f5
3 changed files with 92 additions and 65 deletions

View File

@@ -1,6 +1,41 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace Ursa.Demo.ViewModels;
public class BannerDemoViewModel: ViewModelBase
public partial class BannerDemoViewModel : ViewModelBase
{
private string? _oldTitle = string.Empty;
private string? _oldContent = string.Empty;
[ObservableProperty] private string? _title = "Welcome to Ursa";
[ObservableProperty] private string? _content = "This is the Demo of Ursa Banner.";
[ObservableProperty] private bool _bordered;
[ObservableProperty] private bool _setTitleNull = true;
[ObservableProperty] private bool _setContentNull = true;
partial void OnSetTitleNullChanged(bool value)
{
if (value)
{
Title = _oldTitle;
}
else
{
_oldTitle = Title;
Title = null;
}
}
partial void OnSetContentNullChanged(bool value)
{
if (value)
{
Content = _oldContent;
}
else
{
_oldContent = Content;
Content = null;
}
}
}