<Window x:Class="StructureHelper.Windows.BeamShears.BeamShearResultView"
        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.BeamShears"
        xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
        d:DataContext="{d:DesignInstance local:BeamShearResultViewModel}"
        mc:Ignorable="d"
        Title="Beam Shear Result" Height="450" Width="800" MinHeight="400" MinWidth="600" MaxHeight="900" MaxWidth="1200"  WindowStartupLocation="CenterScreen">
    <DockPanel>
        <ToolBarTray DockPanel.Dock="Top">
            <ToolBar Name="Sections">
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowSectionResultsCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show results by sections"
                                                IconContent="{StaticResource BeamShear}"
                                                DescriptionText="Shows results fo all sections (include sections with invalid results)"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource BeamShear}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowDiagramCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show digram"
                                                IconContent="{StaticResource MomentCurvatureDiagram}"
                                                DescriptionText="Shows diagram for result for inclined section where factor of using is maximum"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource MomentCurvatureDiagram}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ExportToExcelCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Export to Excel"
                                                IconContent="{StaticResource ExportToXLS}"
                                                DescriptionText="Exports results to *.csv file"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource ExportToXLS}"/>
                    </Viewbox>
                </Button>
                <Button Style="{DynamicResource ToolButton}" Command="{Binding ShowGraphResultsCommand}">
                    <Button.ToolTip>
                        <uc:ButtonToolTipEh HeaderText="Show inclined section"
                                                IconContent="{StaticResource BeamShearInclinedSection}"
                                                DescriptionText="Shows graphical results for inclined section where factor of using is maximum"/>
                    </Button.ToolTip>
                    <Viewbox>
                        <ContentControl ContentTemplate="{StaticResource BeamShearInclinedSection}"/>
                    </Viewbox>
                </Button>
            </ToolBar>
        </ToolBarTray>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="22"/>
            </Grid.RowDefinitions>
            <DataGrid x:Name="ResultGrid" IsReadOnly="True" AutoGenerateColumns="False"  ItemsSource="{Binding ActionResults}" 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="Action" Width="170" Binding="{Binding BeamShearAction.Name}"/>
                    <DataGridTextColumn Header="Section" Width="120" Binding="{Binding Section.Name}"/>
                    <DataGridTextColumn Header="Stirrups" Width="120" Binding="{Binding Stirrup.Name}"/>
                    <DataGridTextColumn Header="LimitState" Width="70" Binding="{Binding LimitState}"/>
                    <DataGridTextColumn Header="Duration" Width="70" Binding="{Binding CalcTerm}"/>
                    <!--<DataGridTextColumn Header="Moment Mx" Width="90" Binding="{Binding DesignForceTuple.ForceTuple.Mx, Converter={StaticResource MomentConverter}}"/>
                    <DataGridTextColumn Header="Moment My" Width="90" Binding="{Binding DesignForceTuple.ForceTuple.My, Converter={StaticResource MomentConverter}}"/>
                    <DataGridTextColumn Header="Force Nz" Width="90" Binding="{Binding DesignForceTuple.ForceTuple.Nz, Converter={StaticResource ForceConverter}}"/>
                    <DataGridTextColumn Header="Kx" Width="90" Binding="{Binding LoaderResults.ForceStrainPair.StrainMatrix.Kx}"/>
                    <DataGridTextColumn Header="Ky" Width="90" Binding="{Binding LoaderResults.ForceStrainPair.StrainMatrix.Ky}"/>
                    <DataGridTextColumn Header="EpsZ" Width="90" Binding="{Binding LoaderResults.ForceStrainPair.StrainMatrix.EpsZ}"/>
                    <DataGridTextColumn Header="Accuracy" Width="90" Binding="{Binding LoaderResults.AccuracyRate}"/>
                    <DataGridTextColumn Header="Max Iteration" Width="90" Binding="{Binding LoaderResults.IterationCounter}"/>-->
                    <DataGridTextColumn Header="Description" Width="300" Binding="{Binding Description}"/>
                </DataGrid.Columns>
            </DataGrid>
            <ContentControl Grid.Row="1" ContentTemplate="{StaticResource ResultValidness}" Content="{Binding ValidResultCounter}"/>
        </Grid>
    </DockPanel>
</Window>
