<UserControl x:Class="Valg.EVA.Skanning.Verify.Startup.VerifyBallotPaper.BallotNumber.BallotNumberView"
             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:ballotNumber="clr-namespace:Valg.EVA.Skanning.Verify.Startup.VerifyBallotPaper.BallotNumber"
             xmlns:verifyBallotPaper="clr-namespace:Valg.EVA.Skanning.Verify.Startup.VerifyBallotPaper"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance d:Type=ballotNumber:BallotNumberViewModel}"
             >
    <UserControl.InputBindings>
            <KeyBinding Key="Enter" ></KeyBinding>
    </UserControl.InputBindings>
    <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>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Border Grid.Row="0" FocusManager.FocusedElement="{Binding ElementName=AffiliateDropDown}" Style="{StaticResource BlueBackgroundBorder}"  Padding="25,30,30,30" MinWidth="500">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="30"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <TextBlock Style="{StaticResource NeedsVerificationIcon}" Foreground="White"  Grid.Column="0" Grid.Row="0" Visibility="{Binding NeedsVerification, Converter={StaticResource BooleanToVisibilityConverter}}" />
                <TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource TextBlockMediumHeader}" Foreground="White" Text="{Binding BallotNumberHeaderText}" TextWrapping="Wrap" />
                <StackPanel Grid.Column="1" Grid.Row="1" Focusable="False" verifyBallotPaper:ActiveMainControlManager.IsMainControl="True">
                    <TextBlock Style="{StaticResource TextBlockWhite}" Text="{Binding VerifyLanguageString.BallotNumber_Affiliation, FallbackValue='Gyldig stemmeseddel. Hvilket parti er stemmeseddelen for?'}" />
                    <ComboBox
                    Tag="FocusElement"
                    IsDropDownOpen="{Binding IsDropDownOpen, Mode=TwoWay}"
                    ballotNumber:FocusAdvancement.AdvancesByEnterKey="True"
                    ItemsSource="{Binding AffiliationsToSelectFrom}"
                    DisplayMemberPath="Name"
                    SelectedItem="{Binding SelectedAffiliation}"
                    Background="White" Margin="0,10" Width="350" HorizontalAlignment="Left"
                    Name="AffiliateDropDown"
                    Style="{StaticResource ComboBoxNormal}"
                    DropDownClosed="AffiliateDropDown_OnDropDownClosed"
                        >
                    </ComboBox>
                    <ItemsControl IsTabStop="False" Visibility="{Binding CheckForCorrectionsVisible, Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0,0,0,15">
                        <ItemsControl.Style>
                            <Style>
                                <Setter Property="ItemsControl.Visibility" Value="Collapsed"></Setter>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding CheckForCorrectionsVisible}" Value="True">
                                        <Setter Property="ItemsControl.Visibility" Value="Visible"></Setter>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </ItemsControl.Style>
                        <StackPanel Orientation="Horizontal" Margin="50,0,0,0">
                            <TextBlock Style="{StaticResource TextBlockWhite}" Text="{Binding VerifyLanguageString.BallotNumber_CheckForCorrections}" />
                            <Button IsTabStop="False" Command="{Binding Path=ShowCheckForCorrectionsLightBoxCommand}" Style="{StaticResource WhiteButton}" Margin="28,0,0,5">
                                <Button.Content>
                                    <TextBlock Style="{StaticResource InfoIcon}" />
                                </Button.Content>
                            </Button>
                        </StackPanel>
                        <RadioButton ballotNumber:FocusAdvancement.MovesByEnterKey="{Binding ElementName=NextButtonBlinking}"
                                     ballotNumber:FocusAdvancement.MovesByMouseClick="{Binding ElementName=NextButtonBlinking}"
                                     Margin="30,0,0,0" GroupName="Corrections" Style="{StaticResource BlueRadioButton}" 
                                     IsChecked="{Binding Path=CheckForCorrections, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Yes}" 
                                     Content="{Binding LanguageString.Button_Yes}"/>
                        <RadioButton ballotNumber:FocusAdvancement.MovesByEnterKey="{Binding ElementName=NextButtonBlinking}"
                                     ballotNumber:FocusAdvancement.MovesByMouseClick="{Binding ElementName=NextButtonBlinking}"
                                     Margin="30,0,0,0" GroupName="Corrections" Style="{StaticResource BlueRadioButton}" 
                                     IsChecked="{Binding Path=CheckForCorrections, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=No}" 
                                     Content="{Binding LanguageString.Button_No}" />
                    </ItemsControl>

                    <StackPanel Orientation="Horizontal">
                        <TextBlock Style="{StaticResource TextBlockWhite}" Text="{Binding VerifyLanguageString.BallotNumber_InvalidBallot, FallbackValue='Ugyldig stemmeseddel'}" Margin="0,30,0,10"/>
                        <Button IsTabStop="False" Command="{Binding Path=ShowContestAffiliationLightBoxCommand}" Style="{StaticResource WhiteButton}" Margin="30,30,0,10">
                            <Button.Content>
                                <TextBlock Style="{StaticResource InfoIcon}"></TextBlock>
                            </Button.Content>
                        </Button>
                    </StackPanel>
                    <RadioButton ballotNumber:FocusAdvancement.MovesByEnterKey="{Binding ElementName=NextButtonBlinking}" 
                                 ballotNumber:FocusAdvancement.MovesByMouseClick="{Binding ElementName=NextButtonBlinking}"
                                 GroupName="Rejections" Style="{StaticResource BlueRadioButton}" 
                                 IsChecked="{Binding Path=RejectionReason, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=UnknownElection}" 
                                 Content="{Binding VerifyLanguageString.BallotNumber_UnknownElection}" />
                    <RadioButton ballotNumber:FocusAdvancement.MovesByEnterKey="{Binding ElementName=NextButtonBlinking}" 
                                 ballotNumber:FocusAdvancement.MovesByMouseClick="{Binding ElementName=NextButtonBlinking}"
                                 GroupName="Rejections" Style="{StaticResource BlueRadioButton}" 
                                 IsChecked="{Binding Path=RejectionReason, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=UnknownPartyOrGroup}" 
                                 Content="{Binding VerifyLanguageString.BallotNumber_UnknownPartyOrGroup}" />
                    <RadioButton ballotNumber:FocusAdvancement.MovesByEnterKey="{Binding ElementName=NextButtonBlinking}" 
                                 ballotNumber:FocusAdvancement.MovesByMouseClick="{Binding ElementName=NextButtonBlinking}"
                                 GroupName="Rejections" Style="{StaticResource BlueRadioButton}" 
                                 IsChecked="{Binding Path=RejectionReason, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=PartyOrGroupDoesNotApply}" 
                                 Content="{Binding VerifyLanguageString.BallotNumber_PartyOrGroupDoesNotApplies}" />
                </StackPanel>
            </Grid>
        </Border><Button Grid.Row="1" 
                Name="NextButtonBlinking" Command="{Binding ContinueCommand}" Style="{StaticResource BlueButtonNext}" 
                Height="49" HorizontalAlignment="Left" Margin="0,20" 
                IsEnabled="{Binding IsContinueButtonEnabled}"
                Content="{Binding VerifyLanguageString.Continue, FallbackValue='Neste'}">
        </Button>
    </Grid>
</UserControl>

