<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:primitives="clr-namespace:Avalonia.Controls.Primitives;assembly=Avalonia.Controls"
             xmlns:pc="clr-namespace:Avalonia.Controls.Primitives.Converters;assembly=Avalonia.Controls.ColorPicker"
             mc:Ignorable="d"
             d:DesignWidth="800"
             d:DesignHeight="450"
             x:Class="ControlCatalog.Pages.ColorPickerPage">

  <UserControl.Resources>
    <pc:ThirdComponentConverter x:Key="ThirdComponent" />
  </UserControl.Resources>

  <Grid ColumnDefinitions="Auto,10,Auto">
    <Grid Grid.Column="0"
          Grid.Row="0"
          RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto">
      <ColorSpectrum x:Name="ColorSpectrum1"
                     Grid.Row="0"
                     Color="Red"
                     CornerRadius="10"
                     Height="256"
                     Width="256" />
      <ColorSlider Grid.Row="1"
                   Margin="0,10,0,0"
                   ColorComponent="Component1"
                   ColorModel="Hsva"
                   HsvColor="{Binding HsvColor, ElementName=ColorSpectrum1}" />
      <ColorSlider Grid.Row="2"
                   ColorComponent="Component2"
                   ColorModel="Hsva"
                   HsvColor="{Binding HsvColor, ElementName=ColorSpectrum1}" />
      <ColorSlider Grid.Row="3"
                   ColorComponent="Component3"
                   ColorModel="Hsva"
                   HsvColor="{Binding HsvColor, ElementName=ColorSpectrum1}" />
      <ColorSlider Grid.Row="4"
                   ColorComponent="Alpha"
                   ColorModel="Hsva"
                   HsvColor="{Binding HsvColor, ElementName=ColorSpectrum1}" />
      <ColorPreviewer Grid.Row="5"
                      ShowAccentColors="True"
                      HsvColor="{Binding HsvColor, ElementName=ColorSpectrum1}" />
    </Grid>
    <Grid Grid.Column="2"
          Grid.Row="0"
          ColumnDefinitions="Auto,Auto,Auto"
          RowDefinitions="Auto,Auto">
      <ColorSlider Grid.Column="0"
                   Grid.Row="0"
                   IsAlphaMaxForced="True"
                   IsSaturationValueMaxForced="False"
                   ColorComponent="{Binding Components, ElementName=ColorSpectrum2, Converter={StaticResource ThirdComponent}}"
                   ColorModel="Hsva"
                   Orientation="Vertical"
                   HsvColor="{Binding HsvColor, ElementName=ColorSpectrum2}" />
      <ColorSpectrum x:Name="ColorSpectrum2"
                     Grid.Column="1"
                     Grid.Row="0"
                     Color="Green"
                     Shape="Ring"
                     Height="256"
                     Width="256" />
      <ColorSlider Grid.Column="2"
                   Grid.Row="0"
                   ColorComponent="Alpha"
                   ColorModel="Hsva"
                   Orientation="Vertical"
                   HsvColor="{Binding HsvColor, ElementName=ColorSpectrum2}" />
      <ColorPreviewer Grid.Column="0"
                      Grid.ColumnSpan="3"
                      Grid.Row="1"
                      ShowAccentColors="True"
                      HsvColor="{Binding HsvColor, ElementName=ColorSpectrum2}" />
    </Grid>
  </Grid>
</UserControl>
