<UserControl x:Class="PixiEditor.Views.UserControls.Palettes.CompactPaletteViewer"
             x:ClassModifier="internal"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:PixiEditor.Views.UserControls.Palettes" 
             xmlns:b="http://schemas.microsoft.com/xaml/behaviors" 
             xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
             xmlns:views="clr-namespace:PixiEditor.Views"
             xmlns:ui="clr-namespace:PixiEditor.Extensions.UI;assembly=PixiEditor.Extensions"
             mc:Ignorable="d"  Name="compactPaletteViewer"
             d:DesignHeight="900" d:DesignWidth="30">
    <Grid Background="{StaticResource AccentColor}">
        <ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
            <ItemsControl ItemsSource="{Binding Colors, ElementName=compactPaletteViewer}" AlternationCount="9999">
                <d:ItemsControl.ItemsSource>
                    <x:Array Type="{x:Type Color}">
                        <Color R="0" G="0" B="0" A="255"/>
                        <Color R="255" G="255" B="255" A="255"/>
                        <Color R="255" G="255" B="255" A="150"/>
                        <Color R="255" G="255" B="255" A="0"/>
                        <Color R="255" G="0" B="0" A="255"/>
                        <Color R="0" G="255" B="0" A="255"/>
                        <Color R="0" G="0" B="255" A="255"/>
                    </x:Array>
                </d:ItemsControl.ItemsSource>
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapPanel Orientation="Horizontal"
                                  HorizontalAlignment="Center" VerticalAlignment="Top"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <local:PaletteColorControl ui:Translator.TooltipKey="PALETTE_COLOR_TOOLTIP"
                                            Cursor="Hand"
                                            Color="{Binding}" Width="20" Height="20" CornerRadius="0">
                            <b:Interaction.Triggers>
                                <b:EventTrigger EventName="MouseLeftButtonUp">
                                    <b:InvokeCommandAction
                                    Command="{Binding SelectColorCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CompactPaletteViewer}}}"
                                    CommandParameter="{Binding}" />
                                </b:EventTrigger>
                            </b:Interaction.Triggers>
                        </local:PaletteColorControl>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>
    </Grid>
</UserControl>
