Semi.Avalonia/demo/Semi.Avalonia.Demo/Pages/ColorPickerDemo.axaml

93 lines
4.1 KiB
Plaintext
Raw Normal View History

2023-02-09 18:43:02 +08:00
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
2023-03-26 20:57:03 +08:00
xmlns:colorPicker="clr-namespace:Semi.Avalonia.ColorPicker;assembly=Semi.Avalonia.ColorPicker"
2023-02-09 18:43:02 +08:00
xmlns:controls="using:Avalonia.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
2024-08-11 19:11:11 +08:00
d:DesignHeight="1450"
2023-02-09 18:43:02 +08:00
d:DesignWidth="800"
mc:Ignorable="d">
2024-08-12 16:35:51 +08:00
<ScrollViewer>
<StackPanel Spacing="20">
<StackPanel
VerticalAlignment="Top"
Orientation="Horizontal"
Spacing="20">
2024-08-13 14:45:10 +08:00
<ColorView Name="Test" ColorSpectrumShape="Ring" />
2024-08-12 16:35:51 +08:00
<ColorView ColorSpectrumShape="Box" />
<ColorView Palette="{DynamicResource SemiColorPalette}" />
</StackPanel>
<StackPanel VerticalAlignment="Top" Orientation="Horizontal">
2024-08-12 16:35:51 +08:00
<ColorView
2024-08-13 14:45:10 +08:00
Name="SimpleColorViewTest"
HsvColor="hsv(120,11%,10%)"
2024-08-12 16:35:51 +08:00
IsAlphaVisible="True"
Theme="{StaticResource SimpleColorView}" />
2024-08-13 14:45:10 +08:00
<StackPanel>
<TextBlock Text="{Binding #SimpleColorViewTest.HsvColor}" />
<TextBlock Text="{Binding #SimpleColorViewTest.Color}" />
</StackPanel>
2024-08-12 16:35:51 +08:00
</StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker Margin="8" ColorSpectrumShape="Ring">
2024-08-12 16:35:51 +08:00
<ColorPicker.Palette>
<controls:FlatHalfColorPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker Margin="8" ColorSpectrumShape="Box">
2024-08-12 16:35:51 +08:00
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
<ColorPicker
Margin="8"
ColorSpectrumShape="Box"
Theme="{DynamicResource HexColorPicker}">
2024-08-12 16:35:51 +08:00
<ColorPicker.Palette>
<colorPicker:SemiColorLightPalette />
</ColorPicker.Palette>
</ColorPicker>
</StackPanel>
<StackPanel HorizontalAlignment="Left" >
<TextBlock Text="Use Style to customize button"></TextBlock>
<ColorPicker
Margin="8"
Width="32"
HsvColor="hsv(120,11%,10%)"
>
<ColorPicker.Content>
<Border
Margin="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{Binding $parent[ColorPicker].HsvColor,
Converter={StaticResource ToBrushConverter}}"
CornerRadius="1" />
</ColorPicker.Content>
<ColorPicker.Styles>
<Style Selector="DropDownButton">
<Setter Property="Padding" Value="0"/>
<Style Selector="^ /template/ PathIcon">
<Setter Property="IsVisible" Value="False"/>
</Style>
</Style>
</ColorPicker.Styles>
</ColorPicker>
</StackPanel>
2024-08-12 16:35:51 +08:00
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<ColorPicker
Margin="8"
HsvColor="hsv(120,11%,10%)"
Theme="{StaticResource SimpleColorPicker}" />
<ColorPicker
Margin="8"
HsvColor="hsv(120,11%,10%)"
Theme="{StaticResource HexSimpleColorPicker}" />
2024-08-12 16:35:51 +08:00
</StackPanel>
2023-02-09 18:43:02 +08:00
</StackPanel>
2024-08-12 16:35:51 +08:00
</ScrollViewer>
</UserControl>