<UserControl x:Class="InABox.DynamicGrid.Attachments"
             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"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <ListBox x:Name="FileList" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Padding="5" Grid.Row="0">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border>
                        <StackPanel Orientation="Vertical">
                            <Image Height="64" Width="64" Source="{Binding Item2}" Stretch="UniformToFill"
                                   Tag="{Binding}" MouseDown="Item_MouseDown" />
                            <Label Content="{Binding Item1}" Tag="{Binding}" MouseDown="Item_MouseDown" />
                            <StackPanel.ContextMenu>
                                <ContextMenu>
                                    <MenuItem x:Name="ViewFile" Header="View File" Click="ViewFile_Click"
                                              Tag="{Binding}" />
                                    <Separator />
                                    <MenuItem x:Name="DeleteFile" Header="Delete File" Click="DeleteFile_Click"
                                              Tag="{Binding}" />
                                </ContextMenu>
                            </StackPanel.ContextMenu>
                        </StackPanel>
                    </Border>

                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel IsItemsHost="True" Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ContextMenu>
                <ContextMenu>
                    <MenuItem x:Name="AddFile" Header="Add File" Click="AddFile_Click" />
                </ContextMenu>
            </ListBox.ContextMenu>
        </ListBox>
        <Label Grid.Row="1" Height="40" FontSize="12" HorizontalContentAlignment="Center"
               VerticalContentAlignment="Center" Content="Right-click in the box above to add to this list." />
    </Grid>
</UserControl>