<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    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" mc:Ignorable="d">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Brushes/Icons.xaml"/>
        <ResourceDictionary Source="../BaseControlStyles/ButtonStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Icons/UserCorrectionHasBeenMadeIconStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Icons/NeedsVerificationIconStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Icons/HasNotPersonVoteIconStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Icons/HasPersonVoteIconStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Icons/RenumberIconStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Icons/HasStrikeoutCrossIconStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Icons/HasNotStrikeoutIconStyle.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../Converters/VisibilityConverters.xaml"></ResourceDictionary>
        <ResourceDictionary Source="../BaseControlStyles/TextBlockStyle.xaml"></ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="ToggleButtonWithPopupRenumberStrikeoutFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle SnapsToDevicePixels="true" Stroke="{StaticResource ActiveElementBackgroundBrush}" StrokeThickness="2" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type ToggleButton}" x:Key="ToggleButtonWithPopupRenumberStrikeout">
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="FontFamily" Value="Arial"/>
        <Setter Property="FontSize" Value="18"/>
        <Setter Property="FontWeight" Value="Normal"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ToggleButtonWithPopupRenumberStrikeoutFocusVisual}" />
        <Setter Property="Height" Value="40" />
        <Setter Property="Margin" Value="0" />
        <Setter Property="SnapsToDevicePixels" Value="True"></Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border 
                        Name="border" 
                        CornerRadius="0"
                        Margin="0"
                        Opacity="1"
                        BorderBrush="White"
                        BorderThickness="0"
                        Background="{TemplateBinding Background}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="30"/>
                                <ColumnDefinition Width="30"/>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="50"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding CandidateRankFormatted}"/>
                            <TextBlock Name="UserCorrectionHasBeenMadeIcon" Grid.Column="1" Style="{StaticResource UserCorrectionHasBeenMadeIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding HasUserCorrectionsBeenMade, Converter={StaticResource BooleanToVisibilityConverter}}" />
                            <TextBlock Name="NeedsVerificationIcon"  Grid.Column="1" Style="{StaticResource NeedsVerificationIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding NeedsVerification, Converter={StaticResource BooleanToVisibilityConverter}}" />
                            <TextBlock Name="RenumberIcon" Grid.Column="2" Style="{StaticResource RenumberIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                            <TextBlock Name="RenumberValue" Grid.Column="2" Style="{StaticResource TextBlockLarge}" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding Renumber}" />
                            <TextBlock Name="CandidateName" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,5,0" Style="{StaticResource TextBlockLarge}" Text="{Binding Name}" />
                            <TextBlock Name="HasStrikeOutCrossIcon"  Grid.Column="4" Style="{StaticResource HasStrikeoutCrossIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding HasCandidateBeenStrikedOut, Converter={StaticResource BooleanToVisibilityConverter}}" />
                            <TextBlock Name="HasStrikeOutBoxIcon"  Grid.Column="4" Style="{StaticResource HasNotStrikeoutIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding HasCandidateBeenStrikedOut, Converter={StaticResource BooleanToVisibilityConverter}}" />
                            <TextBlock Name="HasNotStrikeOutIcon" Grid.Column="4" Style="{StaticResource HasNotStrikeoutIcon}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding HasCandidateBeenStrikedOut, Converter={StaticResource InvertedBooleanToVisibilityConverter}}" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="CandidateName" Property="TextDecorations" Value="Underline"></Setter>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <SolidColorBrush Color="{StaticResource ActiveElementBackgroundColor}" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Foreground" Value="White"/>
                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource ActiveElementBackgroundBrush}"/>
                            <Setter TargetName="NeedsVerificationIcon" Property="Foreground" Value="White"></Setter>
                            <Setter TargetName="UserCorrectionHasBeenMadeIcon" Property="Foreground" Value="White"></Setter>
                            <Setter TargetName="RenumberIcon" Property="Foreground" Value="White"></Setter>
                            <Setter TargetName="RenumberValue" Property="Foreground" Value="White"></Setter>
                            <Setter TargetName="HasStrikeOutCrossIcon" Property="Foreground" Value="White"></Setter>
                            <Setter TargetName="HasStrikeOutBoxIcon" Property="Foreground" Value="White"></Setter>
                            <Setter TargetName="HasNotStrikeOutIcon" Property="Foreground" Value="White"></Setter>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <SolidColorBrush Color="White" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="VerifyItemsStyle" TargetType="{x:Type ItemsControl}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ItemsControl}">
                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" Margin="15,0,15,15" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
                    
