<UserControl x:Class="Microscopic_Traffic_Simulator.Views.MainWindowView.ConstructionUserControl"
             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:converters="clr-namespace:Microscopic_Traffic_Simulator.Converters"
             mc:Ignorable="d" 
             d:DesignHeight="38" d:DesignWidth="200">    
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
        <StackPanel.Resources>
            <converters:EnumMatchToBooleanConverter x:Key="enumMatchToBooleanConverter"/>
            <Style x:Key="radioButtonsDependentOnToggleButton" TargetType="RadioButton">
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="Visibility" Value="Collapsed"/>
                <Setter Property="Margin" Value="5,0,5,0"/>
            </Style>
            <Style x:Key="laneTypes" TargetType="RadioButton" 
                   BasedOn="{StaticResource radioButtonsDependentOnToggleButton}">
                <Setter Property="GroupName" Value="LaneType"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ElementName=laneBuildingModeButton, Path=IsChecked}" 
                                 Value="True">
                        <Setter Property="Visibility" Value="Visible"/>                        
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style x:Key="generatorTypes" TargetType="RadioButton" 
                   BasedOn="{StaticResource radioButtonsDependentOnToggleButton}">
                <Setter Property="GroupName" Value="GeneratorType"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ElementName=generatorBuildingModeButton, Path=IsChecked}" 
                                 Value="True">
                        <Setter Property="Visibility" Value="Visible"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </StackPanel.Resources>
        <RadioButton Style="{StaticResource {x:Type ToggleButton}}"
                     GroupName="BuildingMode"
                     IsChecked="{Binding Path=CurrentBuildingMode, Mode=TwoWay,
            Converter={StaticResource enumMatchToBooleanConverter}, ConverterParameter=None}">
            <StackPanel>
                <Image Source="{StaticResource Cursor}"/>
            </StackPanel>
        </RadioButton>
        <RadioButton x:Name="laneBuildingModeButton"
                     Style="{StaticResource {x:Type ToggleButton}}"
                     GroupName="BuildingMode"
                     IsChecked="{Binding Path=CurrentBuildingMode, Mode=TwoWay,
            Converter={StaticResource enumMatchToBooleanConverter}, ConverterParameter=Lane}"                     
                     Unchecked="laneBuildingModeButton_Unchecked">
            <StackPanel>
                <Image Source="{StaticResource Road}"/>
            </StackPanel>
        </RadioButton>
        <RadioButton Content="{DynamicResource StraightRoad}" 
                     IsChecked="{Binding Path=CurrentLaneType, Mode=TwoWay, 
            Converter={StaticResource enumMatchToBooleanConverter}, NotifyOnSourceUpdated=True,
            ConverterParameter=Straight}"
                     SourceUpdated="RadioButton_SourceUpdated"
                     Style="{StaticResource laneTypes}"/>
        <RadioButton Content="{DynamicResource BezierRoad}"
                     IsChecked="{Binding Path=CurrentLaneType, Mode=TwoWay, 
            Converter={StaticResource enumMatchToBooleanConverter}, NotifyOnSourceUpdated=True,
            ConverterParameter=Bezier}"
                     SourceUpdated="RadioButton_SourceUpdated"
                     Style="{StaticResource laneTypes}"/>
        <RadioButton x:Name="generatorBuildingModeButton"
                     Style="{StaticResource {x:Type ToggleButton}}"
                     GroupName="BuildingMode"
                     IsChecked="{Binding Path=CurrentBuildingMode, Mode=TwoWay,
            Converter={StaticResource enumMatchToBooleanConverter}, ConverterParameter=Generator}"
                     Checked="generatorBuildingModeButton_Checked"
                     Unchecked="generatorBuildingModeButton_Unchecked">
            <StackPanel>
                <Image Source="{StaticResource GeneratorBuilding}"/>
            </StackPanel>
        </RadioButton>
        <RadioButton Content="{DynamicResource Generator}" 
                     IsChecked="{Binding Path=CurrentGeneratorType, Mode=TwoWay, 
            Converter={StaticResource enumMatchToBooleanConverter},
            ConverterParameter=Generator, NotifyOnSourceUpdated=True}"
                     SourceUpdated="RadioButton_SourceUpdated"
                     Style="{StaticResource generatorTypes}"/>
        <RadioButton Content="{DynamicResource Sensor}" IsEnabled="False"
                     IsChecked="{Binding Path=CurrentGeneratorType, Mode=TwoWay, 
            Converter={StaticResource enumMatchToBooleanConverter},
            ConverterParameter=Sensor, NotifyOnSourceUpdated=True}"
                     SourceUpdated="RadioButton_SourceUpdated"
                     Style="{StaticResource generatorTypes}"/>
        <Border>
            <Rectangle Style="{StaticResource rectangleAsDivider}"/>
        </Border>
        <Button Click="ButtonInitializeSimulation_Click">
            <StackPanel>
                <Image Source="{StaticResource Forward}"/>
            </StackPanel>
        </Button>
    </StackPanel>
</UserControl>
