<UserControl x:Class="PDFTron.SilverDox.Samples.Controls.ColorPicker"
    x:Name="colorPickerUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:converter="clr-namespace:PDFTron.SilverDox.Samples.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <UserControl.Resources>
        <ItemsPanelTemplate x:Key="WrappingItemListItemsPanelTemplate">
            <controlsToolkit:WrapPanel/>
        </ItemsPanelTemplate>

        <converter:ColorConverter x:Key="ColorConverter"/>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox x:Name="colorsListBox" 
                 ItemsPanel="{StaticResource WrappingItemListItemsPanelTemplate}" 
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                 Width="{Binding Path=Width, ElementName=colorPickerUserControl}"
                 Height="{Binding Path=Height, ElementName=colorPickerUserControl}"
                 SelectedValue="{Binding Path=Value, ElementName=colorPickerUserControl, Converter={StaticResource ColorConverter}, Mode=TwoWay}"
                 SelectedValuePath="Tag">

                 <!--SelectionChanged="colorsListBox_SelectionChanged">-->

                <ListBoxItem Tag="#FF0000">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="Red" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Tag="#FFA500">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="Orange" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Tag="#FFFF00">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="Yellow" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Tag="#90EE90">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="LightGreen" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Tag="#008000">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="Green" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Tag="#0000FF">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="Blue" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Tag="#000000">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="Black" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
                <ListBoxItem Tag="Transparent">
                    <StackPanel Orientation="Horizontal">
                        <Rectangle Stroke="Black" Fill="Transparent" Height="12" Width="12"/>
                    </StackPanel>
                </ListBoxItem>
        </ListBox>

    </Grid>
</UserControl>
