<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures.CurvatureCalculatorResultView"
        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"
        xmlns:local="clr-namespace:StructureHelper.Windows.CalculationWindows.CalculatorsViews.Curvatures"
        xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
        d:DataContext="{d:DesignInstance local:CurvatureCalculatorResultViewModel}"
        mc:Ignorable="d"
        Title="Result of calculation of curvatures and deflections" Height="450" Width="800" MinHeight="300" MinWidth="600" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Windows/CalculationWindows/CalculatorsViews/Curvatures/Curvature.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="40"/>
                <RowDefinition Height="22"/>
            </Grid.RowDefinitions>
            <DataGrid IsReadOnly="True" AutoGenerateColumns="False"  ItemsSource="{Binding ForcesResult}" SelectedItem="{Binding SelectedResult}">
                <DataGrid.RowStyle>
                    <Style TargetType="DataGridRow">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsValid}" Value="false">
                                <Setter Property="Background" Value="{StaticResource ErrorColorBrush}"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </DataGrid.RowStyle>
                <DataGrid.Columns>
                    <DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
                    <DataGridTextColumn Header="Action name" Binding="{Binding InputData.ForcePair.Name}" Width="120"/>
                    <DataGridTemplateColumn Header="Combination term" Width="120">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Grid.Row="0" Text="Long-term"/>
                                    <TextBlock Grid.Row="1" Text="Short-term"/>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="Moment Mx" Width="90">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Grid.Row="0" Text="{Binding InputData.ForcePair.LongForceTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
                                    <TextBlock Grid.Row="1" Text="{Binding InputData.ForcePair.FullForceTuple.Mx, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="Moment My" Width="90">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Grid.Row="0" Text="{Binding InputData.ForcePair.LongForceTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right"/>
                                    <TextBlock Grid.Row="1" Text="{Binding InputData.ForcePair.FullForceTuple.My, Converter={StaticResource MomentConverter}}" HorizontalAlignment="Right" />
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="Force Nz" Width="90">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Grid.Row="0" Text="{Binding InputData.ForcePair.LongForceTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
                                    <TextBlock Grid.Row="1" Text="{Binding InputData.ForcePair.FullForceTuple.Nz, Converter={StaticResource ForceConverter}}" HorizontalAlignment="Right" />
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="delta X" Width="80">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <ContentControl ContentTemplate="{StaticResource DeflectionTextBox}" Content="{Binding ForceCalculatorResult.SectionResult.LongTermResult.DeflectionMy}"/>
                                    <ContentControl Grid.Row="1" ContentTemplate="{StaticResource DeflectionTextBox}" Content="{Binding ForceCalculatorResult.SectionResult.ShortTermResult.DeflectionMy}"/>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="delta Y" Width="80">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <ContentControl ContentTemplate="{StaticResource DeflectionTextBox}" Content="{Binding ForceCalculatorResult.SectionResult.LongTermResult.DeflectionMx}"/>
                                    <ContentControl Grid.Row="1" ContentTemplate="{StaticResource DeflectionTextBox}" Content="{Binding ForceCalculatorResult.SectionResult.ShortTermResult.DeflectionMx}"/>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="delta Z" Width="80">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <ContentControl ContentTemplate="{StaticResource DeflectionTextBox}" Content="{Binding ForceCalculatorResult.SectionResult.LongTermResult.DeflectionNz}"/>
                                    <ContentControl Grid.Row="1" ContentTemplate="{StaticResource DeflectionTextBox}" Content="{Binding ForceCalculatorResult.SectionResult.ShortTermResult.DeflectionNz}"/>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="kx" Width="80">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="{Binding ForceCalculatorResult.SectionResult.LongTermResult.DeflectionMx.Curvature, Converter={StaticResource Curvature}}"/>
                                    <TextBlock Grid.Row="1" Text="{Binding ForceCalculatorResult.SectionResult.ShortTermResult.DeflectionMx.Curvature, Converter={StaticResource Curvature}}"/>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="ky" Width="80">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="{Binding ForceCalculatorResult.SectionResult.LongTermResult.DeflectionMy.Curvature, Converter={StaticResource Curvature}}"/>
                                    <TextBlock Grid.Row="1" Text="{Binding ForceCalculatorResult.SectionResult.ShortTermResult.DeflectionMy.Curvature, Converter={StaticResource Curvature}}"/>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Header="epsz" Width="80">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="{Binding ForceCalculatorResult.SectionResult.LongTermResult.DeflectionNz.Curvature}"/>
                                    <TextBlock Grid.Row="1" Text="{Binding ForceCalculatorResult.SectionResult.ShortTermResult.DeflectionNz.Curvature}"/>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTextColumn Header="Description" Width="300" Binding="{Binding ForceCalculatorResult.Description}"/>
                </DataGrid.Columns>
            </DataGrid>
            <TextBlock Grid.Row="1" Text="{Binding Result.Description}"/>
            <ContentControl Grid.Row="2" ContentTemplate="{StaticResource ResultValidness}" Content="{Binding ValidResultCounter}"/>
        </Grid>
    </DockPanel>
</Window>
