<UserControl x:Class="Aucma.Core.CodeBinding.Views.IndexPageView"
             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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
 Background="#1152AC"     
             FontFamily="Microsoft YaHei"
             xmlns:local="clr-namespace:Aucma.Core.CodeBinding.Views"
             mc:Ignorable="d"       
             d:DesignHeight="800"
             d:DesignWidth="1000" >

    <UserControl.Resources>
        <Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="FontSize" Value="20"/>
        </Style>
        <Style TargetType="DataGrid">
            <!--网格线颜色-->
            <Setter Property="CanUserResizeColumns" Value="false"/>
            <Setter Property="Background" Value="#1152AC" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="HorizontalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#4285DE"/>
                </Setter.Value>
            </Setter>
            <Setter Property="VerticalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#1152AC"/>
                </Setter.Value>
            </Setter>
        </Style>
        <!--列头标题栏样式-->
        <Style TargetType="DataGridColumnHeader">
            <!--<Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>-->
            <!--<Setter Property="Background" Value="#dddddd"/>
            <Setter Property="Foreground" Value="Black"/>-->
            <!--<Setter Property="BorderThickness" Value="1" />-->
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Background" Value="#4285DE"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontFamily" Value="Microsoft YaHei"/>
        </Style>

        <!--单元格样式-->
        <Style TargetType="DataGridCell">
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <Grid Background="{TemplateBinding Background}" >
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="#4285DE"/>
                    <Setter Property="Foreground" Value="White"/>
                </Trigger>
                <DataTrigger Binding="{Binding ExecuteStatus}" Value="2">
                    <Setter Property="Background" Value="Green" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid Margin="1 5 1 0" >
        <Grid.RowDefinitions>
            <RowDefinition Height="0.1*"/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <!--扫描信息-->
        <!--<Border Grid.Row="0"  BorderThickness="1" BorderBrush="#0288d1"  CornerRadius="4" Background="Transparent" Width="100" Height="30" VerticalAlignment="Top" HorizontalAlignment="Center">
            <TextBlock Text="扫描信息" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        </Border>-->
        <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
            <TextBlock Text="扫描信息" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
        </Border>
        <Border Grid.Row="1"  BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Background="Transparent" Margin="3,1,5,5">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="0">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition Height="2*"/>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center"  Margin="200 0 0 0 ">
                        <Label Content="MES条码 " FontSize="20" Foreground="#FFFFFF"/>
                        <TextBox  TextWrapping="Wrap" Text="{Binding Code1}" Width="350" FontSize="20"  Foreground="#FFFFFF"/>
                        <!--<Label Content="订单号 " FontSize="20" Foreground="#FFFFFF"/>
                        <TextBox  TextWrapping="Wrap" Width="300" FontSize="20"  Foreground="#FFFFFF"/>-->
                    </StackPanel>
                    <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="200 0 0 0 ">
                        <Label Content="成品条码 " FontSize="20"  Foreground="#FFFFFF"/>
                        <TextBox  TextWrapping="Wrap" Text="{Binding Code2}" Width="350" FontSize="20"  Foreground="#FFFFFF"/>
                        <!--<Label Content="型号 " FontSize="20"  Foreground="#FFFFFF"/>
                        <TextBox  TextWrapping="Wrap"  Width="300" FontSize="20"  Foreground="#FFFFFF"/>-->
                    </StackPanel>
                    <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="200 0 0 0 ">
                            <Label Content="提示信息 " FontSize="20"  Foreground="#FFFFFF"/>
                            <TextBox  TextWrapping="Wrap" Text="{Binding BindingInfo}" Width="500" Height="150" FontSize="20"  Foreground="#FFFFFF"/>
                        </StackPanel>
                    
                </Grid>
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="1*"/>
                        <RowDefinition Height="9*"/>
                    </Grid.RowDefinitions>
                    <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                        <TextBlock Text="扫描型号统计" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    </Border>
                    <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" >
                        <lvc:CartesianChart Series="{Binding ModelStatistics, UpdateSourceTrigger=PropertyChanged}"   LegendLocation="Top" Foreground="White">
                            <lvc:CartesianChart.DataTooltip >
                                <lvc:DefaultTooltip SelectionMode="OnlySender"  BulletSize="10" Foreground="Black"></lvc:DefaultTooltip>
                            </lvc:CartesianChart.DataTooltip>
                            <lvc:CartesianChart.AxisX >
                                <lvc:Axis Labels="{Binding ProductionHourList}" FontSize="18" Foreground="White" LabelsRotation="0"  DisableAnimations="True" Position="LeftBottom" >
                                    <lvc:Axis.Separator>
                                        <lvc:Separator Visibility="Hidden" Step="1" StrokeThickness="1.5" StrokeDashArray="0" Stroke="#404F56" >
                                        </lvc:Separator>
                                    </lvc:Axis.Separator>
                                </lvc:Axis>
                            </lvc:CartesianChart.AxisX>
                            <lvc:CartesianChart.AxisY>
                                <lvc:Axis FontSize="18" Foreground="White">
                                    <lvc:Axis.Separator>
                                        <lvc:Separator Visibility="Hidden" StrokeThickness="1" StrokeDashArray="3"  Stroke="#404F56" >
                                        </lvc:Separator>
                                    </lvc:Axis.Separator>
                                </lvc:Axis>
                            </lvc:CartesianChart.AxisY>
                        </lvc:CartesianChart>
                        
                       
                    </Border>

                </Grid>
            </Grid>
        </Border>

        <!--扫描记录-->
        <Border Grid.Row="2" Grid.ColumnSpan="2"  BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="3,1,3,5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="9*"/>
                </Grid.RowDefinitions>
                <!--<Border Grid.Row="0"  BorderThickness="1" BorderBrush="#0288d1"  CornerRadius="4" Background="Transparent" Width="100" Height="30" VerticalAlignment="Top" HorizontalAlignment="Center" >
                    <TextBlock Text="扫描纪录" FontSize="20" FontWeight="Bold" Foreground="#0288d1" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>-->
                <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Background="Transparent" Margin="1,1,5,5" >
                    <TextBlock Text="扫描纪录" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
                <!--扫描纪录-->
                <Border x:Name="ScanPanel" Grid.Row="1" Grid.Column="0" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Background="Transparent" Margin="1,1,5,5">
                    <DataGrid Grid.Row="0" ItemsSource="{Binding ListItems}"  Background="#00000000" 
                       ColumnHeaderHeight="35" 
                      RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0" AlternationCount="2" 
                      GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                       BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True"
                      Foreground="White" >

                      
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding No}"     Header="序号"  Width="1*"             ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" />
                            <DataGridTextColumn Binding="{Binding BoxCode}"       Header="MES条码" Width="4*"  ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                            <DataGridTextColumn Binding="{Binding ProductCode}"    Header="成品条码" Width="4*"  ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                            <DataGridTextColumn Binding="{Binding BoxName}"     Header="产品型号" Width="4*"  ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                            <DataGridTextColumn Binding="{Binding BindingResult}"    Header="绑定结果" Width="2*"  ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                            <DataGridTextColumn Binding="{Binding IsPlcPass}"    Header="plc下传结果" Width="2*"  ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                            <DataGridTextColumn Binding="{Binding RecordTime,StringFormat=\{0:yyyy-MM-dd HH:mm\}}"  Header="记录时间" Width="4*"   ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Border>
            </Grid>
        </Border>

    </Grid>
</UserControl>