<Window x:Class="StructureHelper.Windows.CalculationWindows.CalculatorsViews.ForceCalculatorViews.ForceResultsView"
        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.ForceCalculatorViews"
        xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
        d:DataContext="{d:DesignInstance local:ForcesResultsViewModel}"
        mc:Ignorable="d"
        Title="Calculation Results" Height="450" Width="850" MinHeight="400" MinWidth="650" WindowStartupLocation="CenterScreen">
    <DockPanel>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar Name="Prestressing">
                <Button Style="{DynamicResource ToolButton}" Command="{Binding SetPrestrainCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Set prestrain"
                                                IconContent="{StaticResource Prestrain}"
                                                DescriptionText="Set strain from selected combination as auto prestrain (not available if selected result is invalid)"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource Prestrain}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar Name="Lapping">
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowAnchorageCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show lapping length"
                                                IconContent="{StaticResource LappingLength}"
                                                DescriptionText="Calculate and show development and lapping length (not available if selected result is invalid)"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource LappingLength}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar Name="CrackResult">
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowCrackResultCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show crack result step by step"
                                                IconContent="{StaticResource CrackForces}"
                                                DescriptionText="Show proportional combination of forces where cracks are appeared"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource CrackForces}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar Name="InterpolatedResultToolBar">
                <Button Style="{DynamicResource ToolButton}" Command="{Binding InterpolateCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show result step by step"
                                                IconContent="{StaticResource StepSolution}"
                                                DescriptionText="Show result step by step for selected load combination"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource StepSolution}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowGraphsCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show moment-curvature diagram"
                                                IconContent="{StaticResource MomentCurvatureDiagram}"
                                                DescriptionText="Show moment-curvature diagram as result of stepped solution"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource MomentCurvatureDiagram}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding GraphValuePointsCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show diagram by value points"
                                                IconContent="{StaticResource ValuePointDiagram}"
                                                DescriptionText="Show results for value point as result of stepped solution"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ValuePointDiagram}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowCrackGraphsCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show crack moment-curvature diagram"
                                                IconContent="{StaticResource MomentCurvatureCrackDiagram}"
                                                DescriptionText="Show moment-curvature diagram as result of stepped solution with considering cracks"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource MomentCurvatureCrackDiagram}" FontSize="8"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar Name="InteractionDiagramToolBar">
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowInteractionDiagramCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show interaction diagram"
                                                IconContent="{StaticResource InteractionDiagram}"
                                                DescriptionText="Show interaction diagram, which means line of limit bearing capacity"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource InteractionDiagram}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar Name="IsoFieldToolBar">
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoFieldCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show isofield results"
                                                IconContent="{StaticResource IsoFieldResult}"
                                                DescriptionText="Show graphical results with color as function of result value"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource IsoFieldResult}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowIsoField3DCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show isofield results"
                                                IconContent="{StaticResource IsoField3DResult}"
                                                DescriptionText="Show graphical results with color as function of result value"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource IsoField3DResult}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowGeometryResultCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show Geometry Properties"
                                                IconContent="{DynamicResource GeometryTable}"
                                                DescriptionText="Show table of geometry properties of cross-section for selected load combination"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource GeometryTable}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowForceResultCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show Force Properties"
                                                IconContent="{StaticResource ForceTable}"
                                                DescriptionText="Show table of force geometry properties of cross-section - values of forces, moments and their eccentricities"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ForceTable}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
            <ToolBar>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ExportToCSVCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Export to *.csv"
                                                IconContent="{StaticResource ExportToXLS}"
                                                DescriptionText="Export all valid results to *.csv file"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{DynamicResource ExportToXLS}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
        </ToolBarTray>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="22"/>
            </Grid.RowDefinitions>
            <DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False"  ItemsSource="{Binding ForcesResults.ForcesResultList}" SelectedItem="{Binding SelectedResult}" >
                <DataGrid.RowStyle>
                    <Style TargetType="DataGridRow">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsValid}" Value="false">
                                <Setter Property="Background" Value="Pink"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </DataGrid.RowStyle>
                <DataGrid.Columns>
                    <DataGridCheckBoxColumn Header="Valid" Binding="{Binding Path=IsValid}"/>
                    <DataGridTextColumn Header="LimitState" Width="70" Binding="{Binding  StateCalcTermPair.LimitState}"/>
                    <DataGridTextColumn Header="Duration" Width="70" Binding="{Binding StateCalcTermPair.CalcTerm}"/>
                    <DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding ForcesTupleResult.InputData.ForceTuple.Mx, Converter={StaticResource MomentConverter}}"/>
                    <DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding ForcesTupleResult.InputData.ForceTuple.My, Converter={StaticResource MomentConverter}}"/>
                    <DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding ForcesTupleResult.InputData.ForceTuple.Nz, Converter={StaticResource ForceConverter}}"/>
                    <DataGridTextColumn Header="Kx" Width="90" Binding="{Binding ForcesTupleResult.LoaderResults.ForceStrainPair.StrainMatrix.Kx}"/>
                    <DataGridTextColumn Header="Ky" Width="90" Binding="{Binding ForcesTupleResult.LoaderResults.ForceStrainPair.StrainMatrix.Ky}"/>
                    <DataGridTextColumn Header="EpsZ" Width="90" Binding="{Binding ForcesTupleResult.LoaderResults.ForceStrainPair.StrainMatrix.EpsZ}"/>
                    <DataGridTextColumn Header="Accuracy" Width="90" Binding="{Binding ForcesTupleResult.LoaderResults.AccuracyRate}"/>
                    <DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding ForcesTupleResult.LoaderResults.IterationCounter}"/>
                    <DataGridTextColumn Header="Description" Width="300" Binding="{Binding ForcesTupleResult.Description}"/>
                </DataGrid.Columns>
            </DataGrid>
            <ContentControl Grid.Row="1" ContentTemplate="{StaticResource ResultValidness}" Content="{Binding ValidResultCounter}"/>
        </Grid>
    </DockPanel>

</Window>
