<UserControl x:Class="MegaRobo.C00225155App.DataResultView"
             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:mega="clr-namespace:MegaRobo.WpfComponents.MegaControls;assembly=MegaRobo.WpfComponents"
             xmlns:navi="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
             xmlns:local="clr-namespace:MegaRobo.C00225155App"
             mc:Ignorable="d"  DataContext="{Binding DoseDataResultVM,Source={StaticResource vmLocator}}"
             d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <Border BorderBrush="LightGray" BorderThickness="2">
            <Grid>
                <mega:MegaGrid Columns="*" Rows="auto,*">
                    <Border Grid.Row="0" Grid.RowSpan="2" Height="140" Visibility="{Binding HasMadeTask, Converter={StaticResource InvertedBooleanToVisibilityConverter}}">
                        <StackPanel  Height="60"  HorizontalAlignment="Center"  VerticalAlignment="Center"  Orientation="Horizontal">
                            <iconPacks:PackIconMaterial   Width="32"  Height="32"  VerticalAlignment="Center"  Foreground="Chocolate"  Kind="AlertRhombusOutline" />
                            <telerik:Label   Margin="10,0"  VerticalAlignment="Center"  Content="暂无结果信息"  FontSize="30"  Foreground="Chocolate"  />
                        </StackPanel>
                    </Border>
                    <ScrollViewer Grid.Row="0" Grid.RowSpan="2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                        <ItemsControl ItemsSource="{Binding IsUsingResultModeList, Mode=TwoWay}">
                            <!--显示项的模板-->
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Border BorderThickness="0" BorderBrush="#adb5bd" Margin="15,2" Padding="5" CornerRadius="3">
                                        <DockPanel LastChildFill="False">
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock Text="工装号_" Foreground="{StaticResource TextGreyColor}" FontSize="16" />
                                                <TextBlock Text="{Binding BoxId}" Margin="3,0,20,0" Foreground="Black" FontSize="15" />
                                                <TextBlock Text="位置号_" Foreground="{StaticResource TextGreyColor}" FontSize="16" />
                                                <TextBlock Text="{Binding BottleId}" Margin="3,0,20,0" Foreground="Black" FontSize="15"/>
                                                <TextBlock Text="反应物名称_" Foreground="{StaticResource TextGreyColor}" FontSize="16" />
                                                <TextBlock Text="{Binding SampleName}"  Foreground="Black"  FontSize="15"/>
                                            </DockPanel>
                                            <Grid Margin="20,10" DockPanel.Dock="Top" Height="auto" VerticalAlignment="Stretch">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition/>
                                                    <ColumnDefinition Width="50"/>
                                                    <ColumnDefinition/>
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="auto"/>
                                                    <RowDefinition Height="auto"/>
                                                    <RowDefinition Height="*"/>
                                                </Grid.RowDefinitions>
                                                <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" >
                                                    <TextBlock Text="液体名称" Width="80" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                    <TextBlock Text="目标值" Width="100" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                    <TextBlock Text="实际值" Width="100" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                    <TextBlock Text="偏差"  Width="80" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                </StackPanel>
                                                <StackPanel Grid.Row="0" Grid.Column="2" Orientation="Horizontal">
                                                    <TextBlock Text="固体名称" Width="80" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                    <TextBlock Text="目标值" Width="100" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                    <TextBlock Text="实际值" Width="100" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                    <TextBlock Text="偏差"  Width="80" TextAlignment="Center" FontSize="15" Foreground="{StaticResource TextGreyColor}" />
                                                </StackPanel>
                                                <Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="0,10,10,10" Background="LightGray" Height="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                                                <Border Grid.Row="0" Grid.Column="1" Grid.RowSpan="3"  Background="LightGray" Width="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                                                <ItemsControl Grid.Row="2" Grid.Column="0" ItemsSource="{Binding LiquidAdditives, Mode=TwoWay}">
                                                    <!--显示项的模板-->
                                                    <ItemsControl.ItemTemplate>
                                                        <DataTemplate>
                                                            <StackPanel  Orientation="Horizontal" Margin="2" >
                                                                <!--液体名称-->
                                                                <TextBlock Text="{Binding LiquidName}" Width="80" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                                <!--目标值-->
                                                                <TextBlock Text="{Binding TargetWeight}"  Width="100" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                                <!--实际值-->
                                                                <TextBlock  x:Name="actualweight" Text="{Binding ActualAddWeight,StringFormat=F4}"  Width="100" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                                <TextBlock  x:Name="Liquidprecision" Text="{Binding Precision}" Width="80" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                            </StackPanel>
                                                            <DataTemplate.Triggers>
                                                                <DataTrigger Binding="{Binding AddState}" Value="0">
                                                                    <Setter TargetName="actualweight" Property="Background" Value="Transparent" />
                                                                </DataTrigger>
                                                                <DataTrigger Binding="{Binding AddState}" Value="1">
                                                                    <Setter TargetName="actualweight" Property="Background" Value="#ADD8E6" />
                                                                </DataTrigger>
                                                                <DataTrigger Binding="{Binding AddState}" Value="2">
                                                                    <Setter TargetName="actualweight" Property="Background" Value="Transparent" />
                                                                    <!--#FF89E59F-->
                                                                </DataTrigger>
                                                                <MultiDataTrigger>
                                                                    <MultiDataTrigger.Conditions>
                                                                        <Condition Binding="{Binding AddState}" Value="2" />
                                                                        <Condition Binding="{Binding Result}" Value="False" />
                                                                    </MultiDataTrigger.Conditions>
                                                                    <Setter TargetName="Liquidprecision" Property="Foreground" Value="Red" />
                                                                </MultiDataTrigger>
                                                                <!--<MultiDataTrigger>
                                                         <MultiDataTrigger.Conditions>
                                                             <Condition Binding="{Binding AddState}" Value="2" />
                                                             <Condition Binding="{Binding Result}" Value="True" />
                                                         </MultiDataTrigger.Conditions>
                                                         <Setter TargetName="Liquidprecision" Property="Background" Value="#FF89E59F" />
                                                     </MultiDataTrigger>-->
                                                            </DataTemplate.Triggers>
                                                        </DataTemplate>
                                                    </ItemsControl.ItemTemplate>
                                                </ItemsControl>


                                                <ItemsControl Grid.Row="2" Grid.Column="2"  ItemsSource="{Binding PowderAdditives, Mode=TwoWay}">
                                                    <ItemsControl.ItemTemplate>
                                                        <DataTemplate>
                                                            <StackPanel x:Name="PowderContainer" Orientation="Horizontal" Margin="2">
                                                                <!--固体名称-->
                                                                <TextBlock Text="{Binding PowderName}"  Width="80" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                                <!--目标值-->
                                                                <TextBlock Text="{Binding TargetWeight}" Width="100" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                                <!--实际值-->
                                                                <TextBlock  x:Name="actualweight" Text="{Binding ActualAddWeight}" Width="100" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                                <TextBlock  x:Name="PowderPrecision" Text="{Binding Precision}" Width="80" TextAlignment="Center" Foreground="Black" FontSize="15"/>
                                                            </StackPanel>
                                                            <DataTemplate.Triggers>
                                                                <DataTrigger Binding="{Binding AddState}" Value="0">
                                                                    <Setter TargetName="actualweight" Property="Background" Value="Transparent" />
                                                                </DataTrigger>
                                                                <DataTrigger Binding="{Binding AddState}" Value="1">
                                                                    <Setter TargetName="actualweight" Property="Background" Value="#ADD8E6" />
                                                                </DataTrigger>
                                                                <DataTrigger Binding="{Binding AddState}" Value="2">
                                                                    <Setter TargetName="actualweight" Property="Background" Value="Transparent" />
                                                                </DataTrigger>
                                                                <MultiDataTrigger>
                                                                    <MultiDataTrigger.Conditions>
                                                                        <Condition Binding="{Binding AddState}" Value="2" />
                                                                        <Condition Binding="{Binding Result}" Value="False" />
                                                                    </MultiDataTrigger.Conditions>
                                                                    <Setter TargetName="PowderPrecision" Property="Foreground" Value="Red" />
                                                                </MultiDataTrigger>
                                                                <!--<MultiDataTrigger>
                                                         <MultiDataTrigger.Conditions>
                                                             <Condition Binding="{Binding AddState}" Value="2" />
                                                             <Condition Binding="{Binding Result}" Value="True" />
                                                         </MultiDataTrigger.Conditions>
                                                         <Setter TargetName="PowderPrecision" Property="Background" Value="#FF89E59F" />
                                                     </MultiDataTrigger>-->
                                                            </DataTemplate.Triggers>
                                                        </DataTemplate>
                                                    </ItemsControl.ItemTemplate>
                                                </ItemsControl>
                                            </Grid>
                                        </DockPanel>
                                    </Border>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </mega:MegaGrid>
            </Grid>
        </Border>
    </Grid>
</UserControl>
