<Window x:Class="Microscopic_Traffic_Simulator.Views.SettingsView.ParametersWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{DynamicResource SimulatorParameters}" Height="340" Width="480">
    <Grid Margin="5,5,5,5">        
        <Grid.Resources>
            <Style x:Key="Left" 
                   TargetType="FrameworkElement">
                <Setter Property="Grid.Column" 
                        Value="0"/>
                <Setter Property="HorizontalAlignment" 
                        Value="Right"/>
            </Style>
            <Style x:Key="Right" 
                   TargetType="Control">
                <Setter Property="Grid.Column" 
                        Value="1"/>
                <Setter Property="HorizontalAlignment" 
                        Value="Left"/>
            </Style>
            <Style x:Key="RightTextBox" 
                   TargetType="TextBox"
                   BasedOn="{StaticResource Right}">
                <Setter Property="Width"
                        Value="100"/>
            </Style>            
        </Grid.Resources>        
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Horizontal" 
                    Style="{StaticResource Left}"
                    Grid.Row="0">
            <Button Style="{StaticResource Left}"
                    Content="{DynamicResource Default}"
                    Width="70"                                                 
                    Command="{Binding Path=DefaultCommand}"
                    Margin="0,0,10,0"/>
            <Button Style="{StaticResource Left}"
                    Content="{DynamicResource Import}"
                    Width="70"                                                 
                    Command="{Binding Path=ImportCommand}"
                    Margin="0,0,5,0"/>
        </StackPanel>
        <Button Style="{StaticResource Right}"
                Content="{DynamicResource Export}"
                Width="70"  
                Grid.Row="0"
                Command="{Binding Path=ExportCommand}"
                Margin="5,0,0,0"/>
        <Label HorizontalAlignment="Right"
               FontStyle="Oblique"
               Grid.Row="1"
               Grid.Column="0"
               Margin="0,0,0,0">
            <Label.Style>
                <Style TargetType="Label">
                    <Setter Property="Content" 
                            Value="{Binding LastUsedParametersFileName, 
                        FallbackValue=Default parameters}"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=LastUsedParametersFileName.Length, FallbackValue=0, 
                            TargetNullValue=0}"
                                     Value="0">
                            <Setter Property="Content" Value="{DynamicResource DefaultParameters}"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Label.Style>
        </Label>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P1_CellLength}"
               Grid.Row="2"/>
        <TextBox Style="{StaticResource RightTextBox}"
                 Text="{Binding Path=P1_CellLength}"
                 Grid.Row="2"/>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P2_SimulationStepTime}"
               Grid.Row="3"/>
        <TextBox Style="{StaticResource RightTextBox}" 
                 Text="{Binding Path=P2_SimulationStepInterval}"
                 Grid.Row="3"/>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P5_LowSpeedDecProbability}"
               Grid.Row="4"/>
        <TextBox Style="{StaticResource RightTextBox}" 
                 Text="{Binding Path=P5_LowSpeedDecProbability}"
                 Grid.Row="4"/>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P6_DecProbabilitySpeedBound}"
               Grid.Row="5"/>
        <TextBox Style="{StaticResource RightTextBox}" 
                 Text="{Binding Path=P6_DecProbabilitySpeedBound}"
                 Grid.Row="5"/>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P7_AccProbability}"
               Grid.Row="6"/>
        <TextBox Style="{StaticResource RightTextBox}" 
                 Text="{Binding Path=P7_AccelerationProbability}"
                 Grid.Row="6"/>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P8_HighSpeedDecProbability}"
               Grid.Row="7"/>
        <TextBox Style="{StaticResource RightTextBox}" 
                 Text="{Binding Path=P8_HighSpeedDecProbability}"
                 Grid.Row="7"/>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P9_DecRateWhenLeadingAcc}"
               Grid.Row="8"/>
        <TextBox Style="{StaticResource RightTextBox}" 
                 Text="{Binding Path=P9_DecRateWhenLeadingAcc}"
                 Grid.Row="8"/>
        <Label Style="{StaticResource Left}"
               Content="{DynamicResource P10_DecRateWhenLeadingDec}"
               Grid.Row="9"/>
        <TextBox Style="{StaticResource RightTextBox}" 
                 Text="{Binding Path=P10_DecRateWhenLeadingDec}"
                 Grid.Row="9"/>
        <Button Style="{StaticResource Left}"
                Content="{StaticResource Cancel}"
                Click="ButtonCancel_Click"
                Width="70"                                                        
                Margin="0,5,5,0"
                Grid.Row="10"/>
        <Button Style="{StaticResource Right}"
                Content="{StaticResource OK}" 
                Width="70"  
                Click="OK_Click"
                Command="{Binding Path=OkCommand}"
                Margin="0,5,5,0"
                Grid.Row="10"/>        
    </Grid>
</Window>
