mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-03 00:00:55 +08:00
feat: add DynamicResource CopyButton.
This commit is contained in:
@@ -55,11 +55,20 @@
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:VariableItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:VariablesDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:VariablesDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText1}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="StaticResource" />
|
||||
<Button
|
||||
Command="{Binding $parent[pages:VariablesDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText2}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="DynamicResource" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
@@ -70,11 +70,20 @@
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText1}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="StaticResource" />
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText2}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="DynamicResource" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
@@ -134,11 +143,20 @@
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ColorItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText1}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="StaticResource" />
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText2}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="DynamicResource" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
@@ -49,11 +49,20 @@
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText1}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="StaticResource" />
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText2}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="DynamicResource" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
@@ -92,11 +101,20 @@
|
||||
<DataGridTemplateColumn Width="100" Header="CopyText">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="viewModels:ShadowItemViewModel">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText1}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="StaticResource" />
|
||||
<Button
|
||||
Command="{Binding $parent[pages:PaletteDemo].Copy}"
|
||||
CommandParameter="{Binding CopyText2}"
|
||||
Theme="{DynamicResource IconBorderlessButton}"
|
||||
Content="{StaticResource SemiIconCopy}"
|
||||
ToolTip.Tip="DynamicResource" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
@@ -135,11 +135,16 @@ public partial class ColorItemViewModel : ObservableObject
|
||||
[ObservableProperty] private string? _colorResourceKey;
|
||||
[ObservableProperty] private string? _hex;
|
||||
|
||||
public string CopyText =>
|
||||
public string CopyText1 =>
|
||||
$"""
|
||||
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||
""";
|
||||
|
||||
public string CopyText2 =>
|
||||
$"""
|
||||
<DynamicResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||
""";
|
||||
|
||||
public ColorItemViewModel(string colorDisplayName, ISolidColorBrush brush, string resourceKey, bool light,
|
||||
int index)
|
||||
{
|
||||
@@ -196,11 +201,16 @@ public partial class ShadowItemViewModel : ObservableObject
|
||||
[ObservableProperty] private string? _resourceKey;
|
||||
[ObservableProperty] private string? _boxShadowValue;
|
||||
|
||||
public string CopyText =>
|
||||
public string CopyText1 =>
|
||||
$"""
|
||||
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||
""";
|
||||
|
||||
public string CopyText2 =>
|
||||
$"""
|
||||
<DynamicResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||
""";
|
||||
|
||||
public ShadowItemViewModel(string shadowDisplayName, BoxShadows boxShadows, string resourceKey)
|
||||
{
|
||||
ShadowDisplayName = shadowDisplayName;
|
||||
|
||||
@@ -76,11 +76,16 @@ public partial class VariableItemViewModel : ObservableObject
|
||||
[ObservableProperty] private string? _description;
|
||||
[ObservableProperty] private string? _value;
|
||||
|
||||
public string CopyText =>
|
||||
public string CopyText1 =>
|
||||
$"""
|
||||
<StaticResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||
""";
|
||||
|
||||
public string CopyText2 =>
|
||||
$"""
|
||||
<DynamicResource x:Key="" ResourceKey="{ResourceKey}" />
|
||||
""";
|
||||
|
||||
public VariableItemViewModel(string description, object value, string resourceKey)
|
||||
{
|
||||
ResourceKey = resourceKey;
|
||||
|
||||
Reference in New Issue
Block a user