<UserControl x:Class="MWSDomain.Common.UserControls.UserColorBar"
             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:MWSDomain.Common.UserControls"
             mc:Ignorable="d" >
    <Grid>

        <ItemsControl  ItemsSource="{Binding Path=Swatches}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Rows="4" Columns="5"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>

            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="5">
                        <Button  Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type local:UserColorBar}},Path=DataContext.ApplyCommand,Mode=OneTime}" 
                                 CommandParameter="{Binding}"
                                 Width="125" Height="125"
                                 BorderBrush="Transparent"
                                 >
                            <Button.Background>
                                <SolidColorBrush Color="{Binding ExemplarHue.Color,Mode=OneTime}"/>
                            </Button.Background>
                        </Button>
                        <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" Margin="0 5 0 0" Foreground="#9E9E9E" FontSize="12"/>
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>
