<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:library="clr-namespace:Artemis.UI.Screens.Workshop.Library"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Artemis.UI.Screens.Workshop.Library.SubmissionDetailsView"
             x:DataType="library:SubmissionDetailsViewModel">
    <Grid ColumnDefinitions="*,300" RowDefinitions="*, Auto">
        <Border Classes="card" Grid.Column="0" Grid.Row="0">
            <ContentControl Content="{CompiledBinding EntrySpecificationsViewModel}"></ContentControl>
        </Border>
        
        <Border Grid.Column="1" Grid.Row="0" Classes="card" Margin="10 0 0 0">
            <Grid RowDefinitions="*,Auto">
                <ScrollViewer Grid.Row="0" Classes="with-padding" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                    <ItemsControl ItemsSource="{CompiledBinding Images}">
                        <ItemsControl.Styles>
                            <Styles>
                                <Style Selector="ItemsControl > ContentPresenter">
                                    <Setter Property="Margin" Value="0 0 0 10"></Setter>
                                </Style>
                                <Style Selector="ItemsControl > ContentPresenter:nth-last-child(1)">
                                    <Setter Property="Margin" Value="0 0 0 0"></Setter>
                                </Style>
                            </Styles>
                        </ItemsControl.Styles>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>
                </ScrollViewer>
                <Button Grid.Row="1" HorizontalAlignment="Stretch" Command="{CompiledBinding AddImage}">Add image</Button>
            </Grid>
        </Border>

        <StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" HorizontalAlignment="Right" Spacing="5" Orientation="Horizontal" Margin="0 10 0 0">
            <Button Command="{CompiledBinding DiscardChanges}">Discard changes</Button>
            <Button Command="{CompiledBinding SaveChanges}">Save</Button>
        </StackPanel>
    </Grid>
</UserControl>