<UserControl x:Class="StructureHelper.Windows.Forces.ForceInterpolationControl"
             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:uc="clr-namespace:StructureHelper.Windows.UserControls"
             xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
             mc:Ignorable="d" 
             d:DesignHeight="200" d:DesignWidth="460">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="25"/>
            <RowDefinition Height="25"/>
            <RowDefinition Height="25"/>
            <RowDefinition Height="25"/>
            <RowDefinition Height="40"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="110"/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition Width="120"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="1" Text="Moment Mx" HorizontalAlignment="Center"/>
        <TextBlock Grid.Column="2" Text="Moment My" HorizontalAlignment="Center"/>
        <TextBlock Grid.Column="3" Text="Force Nz" HorizontalAlignment="Center"/>
        <TextBlock Grid.Row="1" Text="Start Combination"/>
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding StartMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
        <TextBox Grid.Row="1" Grid.Column="2" Text="{Binding StartMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
        <TextBox Grid.Row="1" Grid.Column="3" Text="{Binding StartNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
        <Button  Grid.Row="2" Grid.Column="1" Command="{Binding CopyToStartCommand}">
            <Viewbox>
                <Canvas Width="24" Height="24">
                    <Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
                </Canvas>
            </Viewbox>
        </Button>
        <Button Grid.Row="2" Grid.Column="2" Command="{Binding InvertForcesCommand}">
            <StackPanel Orientation="Horizontal">
                <Viewbox>
                    <Canvas Width="24" Height="24">
                        <Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
                    </Canvas>
                </Viewbox>
                <Viewbox RenderTransformOrigin="0.5,0.5">
                    <Viewbox.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform Angle="180"/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Viewbox.RenderTransform>
                    <Canvas Width="24" Height="24">
                        <Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
                    </Canvas>
                </Viewbox>
            </StackPanel>
        </Button>
        <Button  Grid.Row="2" Grid.Column="3" Command="{Binding CopyToFinishCommand}">
            <Viewbox RenderTransformOrigin="0.5,0.5">
                <Viewbox.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform Angle="180"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Viewbox.RenderTransform>
                <Canvas Width="24" Height="24">
                    <Path Data="M12 0L5 12h 14z M12 12h 4v 9h-8v-9h 4z" Fill="Black"/>
                </Canvas>
            </Viewbox>
        </Button>
        <TextBlock Grid.Row="3" Text="Finish Combination"/>
        <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding FinishMx, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
        <TextBox Grid.Row="3" Grid.Column="2" Text="{Binding FinishMy, Converter={StaticResource MomentConverter}, ValidatesOnExceptions=True}"/>
        <TextBox Grid.Row="3" Grid.Column="3" Text="{Binding FinishNz, Converter={StaticResource ForceConverter}, ValidatesOnExceptions=True}"/>
        <TextBlock Grid.Row="4" Text="Step count" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
        <TextBox Grid.Row="4" Grid.Column="1" Text="{Binding StepCount, ValidatesOnExceptions=True}" Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
        <uc:MultiplyDouble Grid.Column="4" Grid.Row="1" DoubleFactor="{Binding StartFactor}" ValueChanged="StartValueChanged"/>
        <uc:MultiplyDouble Grid.Column="4" Grid.Row="3" DoubleFactor="{Binding FinishFactor}" ValueChanged="FinishValueChanged"/>
        <uc:MultiplyDouble Grid.Column="4" Grid.Row="4" DoubleFactor="{Binding FinishFactor}" ValueChanged="StepCountValueChanged"  Visibility="{Binding StepCountVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
    </Grid>
</UserControl>
