<UserControl x:Class="Valg.EVA.Skanning.Sample.Startup.Preview.Preview"
             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:preview="clr-namespace:Valg.EVA.Skanning.Sample.Startup.Preview"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{d:DesignInstance d:Type=preview:PreviewViewModel}">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Valg.EVA.Skanning.Assets;component/ResourceDictionaries/ResourceLibrary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>

        <TabControl IsTabStop="False" BorderThickness="0" ItemsSource="{Binding ImageViewModels}" Background="White" SelectedIndex="{Binding CurrentBallotPaperImagePageIndex, Mode=OneWay}" Padding="0" Grid.Row="0">
            <TabControl.Resources>
                <DataTemplate  DataType="{x:Type preview:PreviewBallotPaperImageViewModel}">
                    <ItemsControl IsTabStop="False">
                        <ItemsControl.ItemsSource>
                            <PriorityBinding>
                                <Binding Path="ImagesToDisplay" IsAsync="True" />
                                <Binding />
                            </PriorityBinding>
                        </ItemsControl.ItemsSource>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <preview:PreviewImageView DataContext="{Binding}"></preview:PreviewImageView>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <UniformGrid Columns="1"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>
                </DataTemplate>
            </TabControl.Resources>
            <TabControl.ItemContainerStyle>
                <Style TargetType="TabItem">
                    <Setter Property="Visibility" Value="Collapsed"/>
                </Style>
            </TabControl.ItemContainerStyle>
        </TabControl>

        <StackPanel Grid.Row="1" Orientation="Horizontal">
            <Button Style="{StaticResource LinkButtonWithIcon}" Command="{Binding ShowBallotPaperImageCommand}">
                <Button.Content>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                        <TextBlock Style="{StaticResource OpenImageIcon}" Margin="0,0,8,0" HorizontalAlignment="Center"></TextBlock>
                        <TextBlock HorizontalAlignment="Center" TextDecorations="Underline" Text="{Binding VerifyLanguageString.BallotPaper_ViewFullPage, FallbackValue='Vis seddel i eget vindu'}"/>
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button Style="{StaticResource LinkButtonWithIcon}" Command="{Binding ShowBallotPaperPlacementInBoxCommand}">
                <Button.Content>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                        <TextBlock Style="{StaticResource BallotPaperPlacementInBoxIcon}" Margin="50,0,8,0" HorizontalAlignment="Center"></TextBlock>
                        <TextBlock HorizontalAlignment="Center" TextDecorations="Underline" Text="{Binding VerifyLanguageString.BallotPaper_StackPlacement, FallbackValue='Kasseplassering'}"/>
                    </StackPanel>
                </Button.Content>
            </Button>
        </StackPanel>
    </Grid>

</UserControl>

