<userInterfaceElements:EvaWindow x:Class="Valg.EVA.Skanning.JobManagement.Startup.UI.TransferOverview.TransferDetailsPopupView"
        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:transferOverview="clr-namespace:Valg.EVA.Skanning.JobManagement.Startup.UI.TransferOverview"
        xmlns:userInterfaceElements="clr-namespace:Valg.EVA.Skanning.UserInterfaceElements;assembly=Valg.EVA.Skanning.UserInterfaceElements"
        xmlns:commands1="clr-namespace:Valg.EVA.Skanning.UserInterfaceElements.Commands;assembly=Valg.EVA.Skanning.UserInterfaceElements"
        mc:Ignorable="d"
        Title="TransferDetailsWindow"
        WindowStyle="None"
        BorderThickness="4"
        ResizeMode="NoResize"
        SizeToContent="WidthAndHeight"
        MaxWidth="750"
        WindowStartupLocation="CenterOwner"
        d:DataContext="{d:DesignInstance d:Type=transferOverview:TransferDetailsViewModel}">
    <Window.InputBindings>
        <KeyBinding Key="Escape" 
                    Command="{x:Static commands1:WellKnownSystemCommands.CloseCommand}" 
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />
    </Window.InputBindings>
    <Window.Style>
        <Style>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsErrorState}" Value="true">
                    <Setter Property="Border.BorderBrush" Value="{StaticResource Error}"></Setter>
                </DataTrigger>
            </Style.Triggers>
            <Setter Property="Border.BorderBrush" Value="{StaticResource ActiveElementBackgroundBrush}"></Setter>
        </Style>
    </Window.Style>
    <Grid Margin="25"
         FocusManager.FocusedElement="{Binding ElementName=TransferButton}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Margin="0,0,0,40">
            <StackPanel.Resources>
                <Style TargetType="{x:Type TextBlock}">
                    <Setter Property="FontSize" Value="24"></Setter>
                </Style>
            </StackPanel.Resources>
            <TextBlock FontWeight="Bold" Text="{Binding VotingCategory}"></TextBlock>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding DisctrictCode}" />
                <TextBlock Text="{Binding DisctrictName}" />
                <TextBlock Text="{Binding CountingName}" />
            </StackPanel>
            <TextBlock 
                Visibility="{Binding IsProcessedDuringEmergencyMode, Converter={StaticResource BooleanToVisibilityConverter}}" 
                Margin="0, 10, 0, 0" 
                Style="{StaticResource TextBlockNormal}" 
                Foreground="{StaticResource Error}"
                Text="{Binding JobManagementLanguageString.TransferDetailsPopup_IsProcessedDuringEmergencyModeMessage, Mode=OneWay}" />
        </StackPanel>

        <StackPanel Grid.Row="1" Height="Auto">
            <StackPanel.Resources>
                <Style x:Key="errorTextBlockStyle">
                    <Setter Property="TextBlock.Foreground" Value="{StaticResource Error}" />
                    <Setter Property="TextBlock.Visibility" Value="Collapsed" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsErrorState}" Value="true">
                            <Setter Property="TextBlock.Visibility" Value="Visible" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Resources>
            <TextBlock FontSize="18" Text="{Binding ErrorOnLastAttemptText}" TextWrapping="Wrap" Margin="0,0,0,18"
                       Style="{StaticResource errorTextBlockStyle}"/>
            <TextBlock FontSize="18" Text="{Binding ErrorMessage}" TextWrapping="Wrap" Margin="0,0,0,18" 
                       Style="{StaticResource errorTextBlockStyle}"/>
            <BulletDecorator>
                <BulletDecorator.Bullet>
                    <Ellipse Fill="Black" Stroke="Black" StrokeThickness="1" Width="5" Height="5" />
                </BulletDecorator.Bullet>
                <TextBlock FontSize="18" Margin="10,0,0,0">
                    <TextBlock.Inlines>
                        <Run Text="{Binding TotalVotes, Mode=OneWay}"></Run>
                        <Run Text="{Binding JobManagementLanguageString.TransferDetailsPopup_TotalVotes, Mode=OneWay}"></Run>
                    </TextBlock.Inlines>
                </TextBlock>
            </BulletDecorator>
            <BulletDecorator Margin="0, 0, 0, 18">
                <BulletDecorator.Bullet>
                    <Ellipse Fill="Black" Stroke="Black" StrokeThickness="1" Width="5" Height="5" />
                </BulletDecorator.Bullet>
                <TextBlock FontSize="18" Margin="10,0,0,0">
                    <TextBlock.Inlines>
                        <Run Text="{Binding VerifiedVotes, Mode=OneWay}"></Run>
                        <Run Text="{Binding VerifiedOrInDoubtText, Mode=OneWay}"></Run>
                    </TextBlock.Inlines>
                </TextBlock>
            </BulletDecorator>
            <BulletDecorator Visibility="{Binding IsCountSuggestedRejectedVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
                <BulletDecorator.Bullet>
                    <Ellipse Fill="Black" Stroke="Black" StrokeThickness="1" Width="5" Height="5" />
                </BulletDecorator.Bullet>
                <TextBlock FontSize="18" Margin="10,0,0,0">
                    <TextBlock.Inlines>
                        <Run Text="{Binding SuggestedRejectedVotes, Mode=OneWay}"></Run>
                        <Run Text="{Binding JobManagementLanguageString.TransferDetailsPopup_SuggestedRejectedVotes, Mode=OneWay}"></Run>
                    </TextBlock.Inlines>
                </TextBlock>
            </BulletDecorator>
        </StackPanel>
        <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,40,0,0">
            <Button Name="TransferButton" 
                    Margin="0,0,25,0"
                    Style="{StaticResource BlueButtonOk}"
                    IsEnabled="{Binding IsTransferButtonEnabled}"
                    Command="{Binding TransferCommand}"                    
                    Content="{Binding JobManagementLanguageString.TransferDetailsPopup_Transfer, FallbackValue='Transfer'}"
                    IsDefault="True">
            </Button>
            
            <Button Style="{StaticResource BlueButtonTransfer}" Margin="0,0,25,0" Command="{Binding SaveCommand}"
                    Content="{Binding JobManagementLanguageString.TransferDetailsPopup_SaveToFile, FallbackValue='Save to File'}"
                    Height="49">
            </Button>
           <Button Style="{StaticResource RedButtonCancel}"
                    Height="49"
                    VerticalAlignment="Center"
                    Content="{Binding JobManagementLanguageString.TransferDetailsPopup_Cancel}" 
                    Command="{x:Static commands1:WellKnownSystemCommands.CloseCommand}" 
                    CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
                    IsCancel="True"/>
        </StackPanel>
    </Grid>
</userInterfaceElements:EvaWindow>

