<UserControl x:Class="MaterialTraceabilityUI.MesRequestControl"
             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:local="clr-namespace:MaterialTraceabilityUI"
             mc:Ignorable="d" 
              d:DesignHeight="452" d:DesignWidth="640" Background="Transparent" Loaded="UserControl_Loaded">
    <Border CornerRadius="10" Background="White">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="100"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Border Grid.Row="0" BorderBrush="#007DFA" BorderThickness="1" CornerRadius="10" Background="Transparent">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>
                    <StackPanel Margin="15,0" Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center">
                        <Label Content="开始时间" Foreground="#007DFA" Height="30" HorizontalAlignment="Left"/>
                        <DatePicker x:Name="beginTime" Width="150" HorizontalAlignment="Left" Height="30"/>

                        <Label Margin="20,0,0,0" Content="是否成功" Foreground="#007DFA" Height="30" HorizontalAlignment="Left"/>
                        <ComboBox x:Name="isAlarmInfo" Width="150" Foreground="#007DFA" HorizontalAlignment="Left" VerticalAlignment="Center" Height="30">
                            
                        </ComboBox>

                        <!--<RadioButton Content="查询" Style="{StaticResource NavRadioButtonStyle}" Background="Blue"/>-->
                        <Button x:Name="seach" Content="查询" Background="#007DFA" Foreground="White" Margin="20,0,0,0" Height="30" BorderBrush="DeepSkyBlue" BorderThickness="1" Width="80" Click="Seach_Click"/>
                    </StackPanel>
                    <StackPanel Margin="15,0" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center">
                        <Label Content="结束时间" Foreground="#007DFA" Height="30" HorizontalAlignment="Left"/>
                        <DatePicker x:Name="endTime" Width="150" HorizontalAlignment="Left" Height="30"/>
                    </StackPanel>
                </Grid>

            </Border>

            <Border Grid.Row="1" Margin="0,5,0,0" BorderBrush="#007DFA" BorderThickness="1" CornerRadius="0" Background="Transparent">
                <DataGrid x:Name="ReadRecordDataGrid" Style="{DynamicResource DataGridStyle}"  ColumnHeaderHeight="22" RowHeight="20" AutoGenerateColumns="False" RowHeaderWidth="0" GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0">
                    <DataGrid.Resources>
                        <Style x:Key="DataGridStyle" TargetType="DataGrid">
                            <Setter Property="AlternationCount" Value="2"/>
                            <Setter Property="ColumnHeaderStyle" Value="{DynamicResource DataGridColumnHeaderStyle}"/>
                            <Setter Property="CellStyle" Value="{DynamicResource DataGridCellStyle}"/>
                            <Setter Property="RowStyle" Value="{DynamicResource DataGridRowStyle}"/>
                        </Style>
                        <Style x:Key="DataGridColumnHeaderStyle" TargetType="DataGridColumnHeader">
                            <Setter Property="HorizontalContentAlignment" Value="Center"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="Background" Value="White"/>
                        </Style>
                        <Style x:Key="DataGridRowStyle" TargetType="{x:Type DataGridRow}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridRow}">
                                        <Grid x:Name="DGR_Border" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"/>
                                            <DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}"/>
                                        </Grid>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter Property="BorderBrush" Value="#00BCD4"/>
                                            </Trigger>
                                            <Trigger Property="AlternationIndex" Value="0">
                                                <Setter Property="Background" Value="#E9F3FD"/>
                                            </Trigger>
                                        </ControlTemplate.Triggers>

                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <Style.Triggers>
                                <Trigger Property="IsNewItem" Value="True">
                                    <Setter Property="Margin" Value="{Binding NewItemMargin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                        <Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}">
                            <Setter Property="Background" Value="Transparent"/>
                            <Setter Property="BorderBrush" Value="Transparent"/>
                            <Setter Property="BorderThickness" Value="0"/>
                            <Setter Property="VerticalContentAlignment" Value="Center"/>
                            <Setter Property="HorizontalContentAlignment" Value="Center"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter Property="Foreground" Value="Gray"/>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </DataGrid.Resources>
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding machineId}" Header="机台编号" Width="60"/>
                        <DataGridTextColumn Binding="{Binding interfaceType}" Header="接口类型" Width="*"/>
                        <DataGridTextColumn Binding="{Binding requestParam}" Header="请求参数" Width="*"/>
                        <DataGridTextColumn Binding="{Binding requestState}" Header="请求状态" Width="*"/>
                        <DataGridTextColumn Binding="{Binding requestMessage}" Header="请求信息" Width="*"/>
                        <DataGridTextColumn Binding="{Binding responseCode}" Header="返回编码" Width="*"/>
                        <DataGridTextColumn Binding="{Binding responseMessage}" Header="返回信息" Width="*"/>
                        <DataGridTextColumn Binding="{Binding responseJson}" Header="返回字符" Width="*"/>
                        <DataGridTextColumn Binding="{Binding responseResult}" Header="请求结果" Width="*"/>
                        <DataGridTextColumn Binding="{Binding requestTime}" Header="请求时间" Width="*"/>
                    </DataGrid.Columns>
                </DataGrid>
            </Border>
        </Grid>
    </Border>
</UserControl>