<UserControl x:Class="ScratchNet.ResourceList"
             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:ScratchNet"
             xmlns:lclz="clr-namespace:ScratchNet.localization"
             xmlns:fa="http://schemas.fontawesome.io/icons/"
             IsEnabled="False"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <local:SpriteToImageConverter x:Key="imageConverter"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" MinHeight="100"/>
            <RowDefinition Height="3" MinHeight="3"/>
            <RowDefinition Height="auto" MinHeight="150"/>
        </Grid.RowDefinitions>
        <Border BorderThickness="1" BorderBrush="LightGray" Margin="0" CornerRadius="5, 5, 0, 0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{x:Static lclz:Strings.xaml_CharacterImg}" Grid.Column="1" VerticalAlignment="Center" Margin="5,0,5,0"/>
                    <Button Margin="5" Click="OnImportImage">
                        <Button.Template>
                            <ControlTemplate>
                                <fa:FontAwesome FontSize="25" Foreground="DarkBlue" Icon="FolderOpen"/>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                    <Button Margin="5" >
                        <Button.Template>
                            <ControlTemplate>
                                <fa:FontAwesome FontSize="25" Foreground="DarkBlue" Icon="FileOutline"/>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                </StackPanel>
                <ListView Name="SpriteImageListView" Grid.Row="1">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                    <ListView.Template>
                        <ControlTemplate>
                        <ScrollViewer Margin="0" Padding="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                            <ItemsPresenter/>
                        </ScrollViewer>
                        </ControlTemplate>
                    </ListView.Template>
                    <ListView.ItemContainerStyle>
                        <Style TargetType="{x:Type ListViewItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListViewItem}">
                                        <Border BorderBrush="LightGray" Width="160" BorderThickness="1" CornerRadius="5" Margin="2">
                                            <Grid Margin="2">
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="auto"/>
                                                    <RowDefinition Height="auto"/>
                                                </Grid.RowDefinitions>
                                                <Border>
                                                    <Border.Background>
                                                        <ImageBrush ImageSource="images/th.jpg" TileMode="Tile"/>
                                                    </Border.Background>
                                                </Border>
                                                <Image Margin="1" Source="{Binding Converter={StaticResource imageConverter}}" Height="120"/>
                                                <TextBlock HorizontalAlignment="Center" Grid.Row="1" Text="{Binding Path=DisplayName}"/>
                                                <Border Margin="0" Name="BD_Collector" BorderThickness="1"/>
                                            </Grid>
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsMouseOver" Value="True">
                                                <Setter TargetName="BD_Collector" Property="BorderBrush" Value="YellowGreen" />
                                            </Trigger>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter TargetName="BD_Collector" Property="BorderBrush" Value="Blue" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListView.ItemContainerStyle>
                </ListView>
            </Grid>
        </Border>
        <GridSplitter Grid.Row="1" Grid.ColumnSpan="1" Height="5" Background="White" 
                          HorizontalAlignment="Stretch"
                          ShowsPreview="True"/>
        <Border Grid.Row="2" Margin="0" BorderBrush="LightGray" BorderThickness="1" CornerRadius="0,0, 5, 5">

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{x:Static lclz:Strings.xaml_Sound}" Grid.Column="1" VerticalAlignment="Center" Margin="5,0,5,0"/>
                    <Button Margin="5" Click="OnImportSound">
                        <Button.Template>
                            <ControlTemplate>
                                <fa:FontAwesome FontSize="25" Foreground="DarkBlue" Icon="CloudUpload"/>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                    <Button Margin="5" >
                        <Button.Template>
                            <ControlTemplate>
                                <fa:FontAwesome FontSize="25" Foreground="DarkBlue" Icon="Microphone"/>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                    <Button Margin="5" >
                        <Button.Template>
                            <ControlTemplate>
                                <fa:FontAwesome FontSize="25" Foreground="DarkBlue" Icon="PlayCircle"/>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                    <Button Margin="5" >
                        <Button.Template>
                            <ControlTemplate>
                                <fa:FontAwesome FontSize="25" Foreground="DarkBlue" Icon="TimesCircleOutline"/>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>
