Files
Semi.Avalonia/demo/Semi.Avalonia.Demo/Controls/ColorDetailControl.axaml

128 lines
6.6 KiB
Plaintext
Raw Normal View History

2023-02-13 00:14:56 +08:00
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2024-12-24 16:39:57 +08:00
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls">
2023-02-13 00:14:56 +08:00
<ControlTheme x:Key="{x:Type controls:ColorDetailControl}" TargetType="controls:ColorDetailControl">
2024-12-24 16:39:57 +08:00
<Setter Property="Template">
2023-02-13 00:14:56 +08:00
<ControlTemplate TargetType="controls:ColorDetailControl">
<StackPanel>
<TextBlock
Margin="0,0,0,8"
Classes="H5"
Text="{TemplateBinding ResourceName}"
Theme="{DynamicResource TitleTextBlock}" />
<Border
Height="100"
HorizontalAlignment="Stretch"
Background="{TemplateBinding Background}"
CornerRadius="6" />
2023-03-27 11:25:47 +08:00
<Grid ColumnDefinitions="*, Auto" RowDefinitions="*, *, *, *, *, *, *">
<!-- Row 0-1-2 ResourceKey -->
2023-02-13 00:14:56 +08:00
<TextBlock
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="4,8,0,0"
VerticalAlignment="Center"
Classes="Tertiary"
Text="ResourceKey" />
<SelectableTextBlock
Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Center"
Text="{TemplateBinding ResourceKey}" />
<Button
Grid.Row="1"
Grid.Column="1"
Classes="Tertiary"
Padding="8"
2023-02-13 00:14:56 +08:00
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ResourceKey}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
2023-02-13 00:14:56 +08:00
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
2023-03-27 11:25:47 +08:00
<SelectableTextBlock
Grid.Row="2"
Grid.Column="0"
VerticalAlignment="Center"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
Text="{TemplateBinding ColorResourceKey}" />
<Button
Grid.Row="2"
Grid.Column="1"
Classes="Tertiary"
Padding="8"
2023-03-27 11:25:47 +08:00
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_ColorResourceKey}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ColorResourceKey, Converter={x:Static ObjectConverters.IsNotNull}}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
2023-03-27 11:25:47 +08:00
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
2023-02-13 00:14:56 +08:00
2023-03-27 11:25:47 +08:00
<!-- Row 3-4 HEX -->
2023-02-13 00:14:56 +08:00
<TextBlock
2023-03-27 11:25:47 +08:00
Grid.Row="3"
2023-02-13 00:14:56 +08:00
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="4,8,0,0"
VerticalAlignment="Center"
Classes="Tertiary"
Text="ARGB" />
<SelectableTextBlock
2023-03-27 11:25:47 +08:00
Grid.Row="4"
2023-02-13 00:14:56 +08:00
Grid.Column="0"
VerticalAlignment="Center"
Text="{TemplateBinding Hex}" />
<Button
2023-03-27 11:25:47 +08:00
Grid.Row="4"
2023-02-13 00:14:56 +08:00
Grid.Column="1"
Classes="Tertiary"
Padding="8"
2023-02-13 00:14:56 +08:00
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Hex}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
2023-02-13 00:14:56 +08:00
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
2023-03-27 11:25:47 +08:00
<!-- Row 5-6 Opacity -->
2023-02-13 00:14:56 +08:00
<TextBlock
2023-03-27 11:25:47 +08:00
Grid.Row="5"
2023-02-13 00:14:56 +08:00
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="4,8,0,0"
VerticalAlignment="Center"
Classes="Tertiary"
Text="Opacity" />
<SelectableTextBlock
2023-03-27 11:25:47 +08:00
Grid.Row="6"
2023-02-13 00:14:56 +08:00
Grid.Column="0"
VerticalAlignment="Center"
Text="{TemplateBinding OpacityNumber}" />
<Button
2023-03-27 11:25:47 +08:00
Grid.Row="6"
2023-02-13 00:14:56 +08:00
Grid.Column="1"
Classes="Tertiary"
Padding="8"
2023-02-13 00:14:56 +08:00
Command="{Binding $parent[controls:ColorDetailControl].Copy}"
CommandParameter="{x:Static controls:ColorDetailControl.KEY_Opacity}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Theme="{DynamicResource InnerPathIcon}"
Data="{StaticResource SemiIconCopy}"
2023-02-13 00:14:56 +08:00
Foreground="{Binding $parent[Button].Foreground}" />
</Button>
</Grid>
</StackPanel>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>