<UserControl x:Class="Valg.EVA.Skanning.JobManagement.Startup.UI.Counting.BoxCountingView"
             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:counting="clr-namespace:Valg.EVA.Skanning.JobManagement.Startup.UI.Counting"
             mc:Ignorable="d"
             d:DataContext="{d:DesignInstance d:Type=counting:CountingViewModel}"
             d:DesignHeight="300" d:DesignWidth="500">
    
    <Grid Grid.IsSharedSizeScope="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.Resources>
                <Style BasedOn="{StaticResource TextBlockNormal  }" TargetType="TextBlock">
                    <Setter Property="Foreground" Value="White" />
                    <Setter Property="Padding" Value="10" />
                    <Setter Property="Background" Value="{StaticResource DefaultBlackishBackground}" />
                    <Setter Property="HorizontalAlignment" Value="Stretch" />
                </Style>
                <Style TargetType="Border">
                    <Setter Property="BorderThickness" Value="1,1,1,0" />
                    <Setter Property="BorderBrush" Value="{StaticResource GrayBorder}" />
                    <Setter Property="HorizontalAlignment" Value="Stretch" />
                </Style>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition SharedSizeGroup="Box" MinWidth="215" Width="*" />
                <ColumnDefinition SharedSizeGroup="Scanned" MinWidth="100" Width="*" />
                <ColumnDefinition SharedSizeGroup="ToVerify" MinWidth="100" Width="*" />
                <ColumnDefinition SharedSizeGroup="Status" MinWidth="215" Width="*" />
            </Grid.ColumnDefinitions>
            <Border Grid.Column="0">
                <TextBlock Text="{Binding JobManagementLanguageString.BoxCounting__ColumnTitle_Box}" />
            </Border>
            <Border Grid.Column="1">
                <TextBlock Text="{Binding JobManagementLanguageString.BoxCounting__ColumnTitle_Scanned}" />
            </Border>
            <Border Grid.Column="2">
                <TextBlock Text="{Binding ToVerifyOrInDoubtColumnTitle}" />
            </Border>
            <Border Grid.Column="3">
                <TextBlock Text="{Binding JobManagementLanguageString.BoxCounting__ColumnTitle_Status}" />
            </Border>
        </Grid>
        <Border Grid.Row="1" BorderBrush="{StaticResource GrayBorder}" BorderThickness="0,0,0,1">
            <ItemsControl IsTabStop="False" ItemsSource="{Binding BoxCountings}" AlternationCount="2">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.Resources>
                                <Style BasedOn="{StaticResource TextBlockNormal  }" TargetType="TextBlock">
                                    <Setter Property="Padding" Value="10" />
                                    <Setter Property="Margin" Value="1,0,0,0" />
                                </Style>
                            </Grid.Resources>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition SharedSizeGroup="Box" />
                                <ColumnDefinition SharedSizeGroup="Scanned" />
                                <ColumnDefinition SharedSizeGroup="ToVerify" />
                                <ColumnDefinition SharedSizeGroup="Status" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Name="BoxCell"><Button Style="{StaticResource LinkButtonNormal  }" 
                                        Content="{Binding BoxName }" 
                                        CommandParameter="{Binding}" 
                                        Command="{Binding ShowClearBoxCommand}"
                                        IsEnabled="{Binding IsEnabled}"/>
                            </TextBlock>
                            <TextBlock Grid.Column="1" Name="ScannedCell" Text="{Binding ScannedBallots }" />
                            <TextBlock Grid.Column="2" Name="ToVerifyCell" Text="{Binding BallotsToVerify }" />
                            <TextBlock Grid.Column="3" Name="StatusCell" Text="{Binding Status}"  />                            
                        </Grid>
                        <DataTemplate.Triggers>
                            <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                                <Setter Property="Background" Value="{StaticResource AlternatingRow}" TargetName="BoxCell" />
                                <Setter Property="Foreground" Value="{StaticResource AlternatingRow}" TargetName="BoxCell" />
                                <Setter Property="Background" Value="{StaticResource AlternatingRow}" TargetName="ScannedCell" />
                                <Setter Property="Background" Value="{StaticResource AlternatingRow}" TargetName="ToVerifyCell" />
                                <Setter Property="Background" Value="{StaticResource AlternatingRow}" TargetName="StatusCell" />                                
                            </Trigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Border>
    </Grid>
</UserControl>
