diff --git a/demo/Semi.Avalonia.Demo/Pages/ColorPickerDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ColorPickerDemo.axaml index 0dc1a33..e46c763 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ColorPickerDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/ColorPickerDemo.axaml @@ -2,80 +2,90 @@ x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo" xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:semi="https://irihi.tech/semi" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="1450" d:DesignWidth="800" mc:Ignorable="d"> - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/src/Semi.Avalonia.ColorPicker/Controls/ColorPicker.axaml b/src/Semi.Avalonia.ColorPicker/Controls/ColorPicker.axaml index 5e6dbdc..1294a3b 100644 --- a/src/Semi.Avalonia.ColorPicker/Controls/ColorPicker.axaml +++ b/src/Semi.Avalonia.ColorPicker/Controls/ColorPicker.axaml @@ -2,38 +2,48 @@ xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:iri="https://irihi.tech/shared" - xmlns:converters="using:Avalonia.Controls.Converters"> - + xmlns:semi="https://irihi.tech/semi"> + + + + + + + + - + + + + - - - - + - + @@ -81,7 +92,7 @@ Padding="0" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" - SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"> + SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}"> - - - - - - - - - - @@ -302,11 +285,11 @@ AllowSpin="True" Classes="Small" IsVisible="{TemplateBinding IsComponentTextInputVisible}" - Maximum="{Binding Maximum, ElementName=Component1Slider}" - Minimum="{Binding Minimum, ElementName=Component1Slider}" + Maximum="{Binding #Component1Slider.Maximum}" + Minimum="{Binding #Component1Slider.Minimum}" NumberFormat="{StaticResource ColorViewComponentNumberFormat}" ShowButtonSpinner="False" - Value="{Binding Value, ElementName=Component1Slider}" /> + Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> + Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> + Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" /> + Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}"> - - + + @@ -412,7 +395,7 @@ VerticalAlignment="Center" ColorComponent="Alpha" ColorModel="{TemplateBinding ColorModel,Mode=OneWay}" - HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" + HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" IsEnabled="{TemplateBinding IsAlphaEnabled}" IsRoundingEnabled="True" IsSnapToTickEnabled="True" @@ -420,8 +403,8 @@ TickFrequency="1"> - - + + @@ -429,11 +412,11 @@ - + @@ -442,9 +425,33 @@ - - + + + + + + + + @@ -452,38 +459,34 @@ x:Key="HexColorPicker" BasedOn="{StaticResource {x:Type ColorPicker}}" TargetType="ColorPicker"> - - - - + + + - + - - + + - + @@ -534,6 +540,7 @@ Name="ColorSpectrum" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" + CornerRadius="8 8 0 0" Components="{TemplateBinding ColorSpectrumComponents}" HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}" MaxHue="{TemplateBinding MaxHue}" @@ -584,35 +591,43 @@ CornerRadius="4" /> + IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}" + MaxLength="8"> + + 0 0 4 0 + + + CornerRadius="3 0 0 3" + IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}" + Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" /> + CornerRadius="3 0 0 3" + IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}" + Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" /> + Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}"> + + 12 0 4 0 + 4 0 0 0 + + - HexRgba + Hex + Rgba Hsva @@ -647,37 +669,8 @@ x:Key="HexSimpleColorPicker" BasedOn="{StaticResource SimpleColorPicker}" TargetType="ColorPicker"> - - - - + + \ No newline at end of file diff --git a/src/Semi.Avalonia.ColorPicker/Controls/ColorPreviewer.axaml b/src/Semi.Avalonia.ColorPicker/Controls/ColorPreviewer.axaml index f554485..4d0eef1 100644 --- a/src/Semi.Avalonia.ColorPicker/Controls/ColorPreviewer.axaml +++ b/src/Semi.Avalonia.ColorPicker/Controls/ColorPreviewer.axaml @@ -1,15 +1,13 @@ - + xmlns:iri="https://irihi.tech/shared"> - + diff --git a/src/Semi.Avalonia.ColorPicker/Controls/ColorSlider.axaml b/src/Semi.Avalonia.ColorPicker/Controls/ColorSlider.axaml index 6096327..e2cd8b7 100644 --- a/src/Semi.Avalonia.ColorPicker/Controls/ColorSlider.axaml +++ b/src/Semi.Avalonia.ColorPicker/Controls/ColorSlider.axaml @@ -1,9 +1,6 @@ - - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> @@ -12,7 +9,7 @@ - + - + - - + + VerticalAlignment="Center" + Height="{Binding #PART_Track.Bounds.Height}" + Background="{TemplateBinding Background}" + CornerRadius="{DynamicResource ColorSliderCornerRadius}" /> + + Theme="{DynamicResource ColorSliderThumbTheme}" /> @@ -114,32 +108,28 @@ - + - - + + Width="{Binding #PART_Track.Bounds.Width}" + Background="{TemplateBinding Background}" + CornerRadius="{DynamicResource ColorSliderCornerRadius}" /> + Theme="{DynamicResource ColorSliderThumbTheme}" /> diff --git a/src/Semi.Avalonia.ColorPicker/Controls/ColorSpectrum.axaml b/src/Semi.Avalonia.ColorPicker/Controls/ColorSpectrum.axaml index 0df128a..146b55b 100644 --- a/src/Semi.Avalonia.ColorPicker/Controls/ColorSpectrum.axaml +++ b/src/Semi.Avalonia.ColorPicker/Controls/ColorSpectrum.axaml @@ -1,15 +1,11 @@ - - - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - + + RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}" + RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" /> + RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}" + RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" /> + RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}" + RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" /> diff --git a/src/Semi.Avalonia.ColorPicker/Controls/ColorView.axaml b/src/Semi.Avalonia.ColorPicker/Controls/ColorView.axaml index b8031f2..f23e2db 100644 --- a/src/Semi.Avalonia.ColorPicker/Controls/ColorView.axaml +++ b/src/Semi.Avalonia.ColorPicker/Controls/ColorView.axaml @@ -1,28 +1,23 @@ - - - - - - - - - - + xmlns:semi="https://irihi.tech/semi"> - + + + + - - - - - - - - - - + + + + + + @@ -61,11 +52,11 @@ CornerRadius="{TemplateBinding CornerRadius}"> + AllowAutoHide="{TemplateBinding ScrollViewer.AllowAutoHide}" + HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" + IsScrollChainingEnabled="{TemplateBinding ScrollViewer.IsScrollChainingEnabled}" + IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" + VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"> - - + + - + @@ -141,12 +132,14 @@ Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CornerRadius="{TemplateBinding CornerRadius}" - RecognizesAccessKey="True" TextElement.FontSize="{TemplateBinding FontSize}" TextElement.FontWeight="{TemplateBinding FontWeight}" UseLayoutRounding="False" /> +