feat: add CopyText to PaletteDemo.

This commit is contained in:
Zhang Dian
2025-01-21 20:24:21 +08:00
parent 232ce71677
commit e981fe1c82
4 changed files with 102 additions and 37 deletions

View File

@@ -7,8 +7,8 @@ using Avalonia.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using Semi.Avalonia.Demo.Constant;
using Semi.Avalonia.Tokens.Palette;
using Semi.Avalonia.Demo.Converters;
using Semi.Avalonia.Tokens.Palette;
namespace Semi.Avalonia.Demo.ViewModels;
@@ -135,6 +135,11 @@ public partial class ColorItemViewModel : ObservableObject
[ObservableProperty] private string? _colorResourceKey;
[ObservableProperty] private string? _hex;
public string CopyText =>
$"""
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
""";
public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, string resourceKey, bool light,
int index)
{
@@ -191,6 +196,11 @@ public partial class ShadowItemViewModel : ObservableObject
[ObservableProperty] private string? _resourceKey;
[ObservableProperty] private string? _boxShadowValue;
public string CopyText =>
$"""
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
""";
public ShadowItemViewModel(string shadowDisplayName, BoxShadows boxShadows, string resourceKey)
{
ShadowDisplayName = shadowDisplayName;