<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="QC.TestResultsLite.TestResultsLite" 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" x:Name="QSPRTestResults" xmlns:testresultslite="clr-namespace:QC.TestResultsLite;assembly=TestResultsLite">
  <FrameworkElement.Resources>
    <ResourceDictionary>
      <Style x:Key="{x:Type DataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="Background" Value="#FF1D4387" />
        <Setter Property="Foreground" Value="#FFFFFFFF" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="BorderBrush" Value="#FFFFFFFF" />
        <Setter Property="BorderThickness" Value="0,0,1,0" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="2" />
      </Style>
      <Style x:Key="ButtonOfficeStyle" TargetType="{x:Type Button}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Background" Value="#00FFFFFF" />
        <Setter Property="BorderBrush" Value="#00FFFFFF" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
              <Border Name="Bd" BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="{TemplateBinding Control.BorderThickness}" Background="{TemplateBinding Control.Background}" Padding="{TemplateBinding Control.Padding}" SnapsToDevicePixels="True">
                <ContentPresenter ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" Content="{TemplateBinding ContentControl.Content}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" />
              </Border>
              <ControlTemplate.Triggers>
                <Trigger Property="UIElement.IsMouseOver" Value="True">
                  <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#FF000000" />
                  <Setter TargetName="Bd" Property="Border.Background">
                    <Setter.Value>
                      <SolidColorBrush Color="#FFFFDFA9" />
                    </Setter.Value>
                  </Setter>
                </Trigger>
                <Trigger Property="UIElement.IsKeyboardFocused" Value="True">
                  <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#FF3399FF" />
                  <Setter TargetName="Bd" Property="Border.Background" Value="#FFC2E0FF" />
                </Trigger>
                <Trigger Property="IsPressed" Value="True">
                  <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#FF3399FF" />
                  <Setter TargetName="Bd" Property="Border.Background" Value="#FF99CCFF" />
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                  <Setter Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" Property="Foreground" />
                </Trigger>
              </ControlTemplate.Triggers>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
    </ResourceDictionary>
  </FrameworkElement.Resources>
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="97" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <StackPanel Orientation="Vertical" Grid.Column="0" Background="#FFFFFFFF">
      <Expander ExpandDirection="Down" IsExpanded="True">
        <HeaderedContentControl.Header>
          <TextBlock Text="Export To" FontSize="12" />
        </HeaderedContentControl.Header>
        <StackPanel Orientation="Vertical">
          <Button ToolTip="Export to Excel" Content="Excel" Width="80" Height="24" FontSize="12" Margin="2,4,2,2" Click="ExportToExcelButton_Click" />
          <Button ToolTip="Export to CSV" Content="CSV" Width="80" Height="24" FontSize="12" Margin="2" Click="ExportToCsvButton_Click" />
          <Button ToolTip="Clear grid" Content="Clear Grid" Width="80" Height="24" FontSize="12" Margin="2,2,2,4" Click="ClearGridResultsButton_Click" />
        </StackPanel>
      </Expander>
      <Expander ExpandDirection="Down" IsExpanded="True">
        <HeaderedContentControl.Header>
          <TextBlock Text="Configuration" FontSize="11" />
        </HeaderedContentControl.Header>
        <StackPanel Orientation="Vertical">
          <Button ToolTip="Test results configuration" Content="Edit Config" Width="80" Height="24" FontSize="12" Margin="2,4,2,2" Click="ConfigurationsButton_Click" />
          <Button ToolTip="Convert intermediate xml files" Content="Convert" Width="80" Height="24" FontSize="12" Margin="2,2,2,4" Click="ConvertIntermediateFiles_Click" />
        </StackPanel>
      </Expander>
      <Expander ExpandDirection="Down" IsExpanded="True">
        <HeaderedContentControl.Header>
          <TextBlock Text="Help" FontSize="11" />
        </HeaderedContentControl.Header>
        <StackPanel Orientation="Vertical">
          <Button Content="Help" Width="80" Height="24" FontSize="12" Margin="2,4,2,2" Click="TestResultsHelp_Click" />
        </StackPanel>
      </Expander>
    </StackPanel>
    <DataGrid Name="ultraGridResults" Grid.Column="1" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserResizeRows="False">
      <DataGrid.Columns>
        <DataGridTextColumn IsReadOnly="True" Header="UUT__SN" Binding="{Binding UUT_SN}" />
        <DataGridTextColumn IsReadOnly="True" Header="Test Name" Binding="{Binding TestName}" />
        <DataGridTextColumn IsReadOnly="True" Header="Param Name" Binding="{Binding ParameterName}" />
        <DataGridTextColumn IsReadOnly="True" Header="Loop Details" Binding="{Binding ScnValue}" />
        <DataGridTextColumn IsReadOnly="True" Header="LL" Binding="{Binding LowerLimit}" />
        <DataGridTextColumn IsReadOnly="True" Header="Param Num Value" Binding="{Binding NumValue}">
          <DataGridBoundColumn.ElementStyle>
            <Style TargetType="{x:Type TextBlock}">
              <Style.Triggers>
                <MultiDataTrigger>
                  <MultiDataTrigger.Conditions>
                    <Condition Value="Failed" Binding="{Binding TestResult}" />
                    <Condition Value="Failed" Binding="{Binding ParamResult}" />
                  </MultiDataTrigger.Conditions>
                  <Setter Property="Background" Value="#FFFF0000" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                  <MultiDataTrigger.Conditions>
                    <Condition Value="Passed" Binding="{Binding TestResult}" />
                    <Condition Value="Failed" Binding="{Binding ParamResult}" />
                  </MultiDataTrigger.Conditions>
                  <Setter Property="Background" Value="#FFFFFF00" />
                </MultiDataTrigger>
              </Style.Triggers>
            </Style>
          </DataGridBoundColumn.ElementStyle>
        </DataGridTextColumn>
        <DataGridTextColumn IsReadOnly="True" Header="UL" Binding="{Binding UpperLimit}" />
        <DataGridTextColumn IsReadOnly="True" Header="Param Char Value" Binding="{Binding CharValue}" />
        <DataGridTextColumn IsReadOnly="True" Header="UOM" Binding="{Binding UOM}" />
        <DataGridTextColumn IsReadOnly="True" Header="TestResult" Binding="{Binding TestResult}">
          <DataGridBoundColumn.ElementStyle>
            <Style TargetType="{x:Type TextBlock}">
              <Style.Triggers>
                <Trigger Property="Text" Value="Failed">
                  <Setter Property="Background" Value="#FFFF0000" />
                </Trigger>
              </Style.Triggers>
            </Style>
          </DataGridBoundColumn.ElementStyle>
        </DataGridTextColumn>
        <DataGridTextColumn IsReadOnly="True" Header="ParamResult" Binding="{Binding ParamResult}">
          <DataGridBoundColumn.ElementStyle>
            <Style TargetType="{x:Type TextBlock}">
              <Style.Triggers>
                <Trigger Property="Text" Value="Failed">
                  <Setter Property="Background" Value="#FFFF0000" />
                </Trigger>
              </Style.Triggers>
            </Style>
          </DataGridBoundColumn.ElementStyle>
        </DataGridTextColumn>
        <DataGridTextColumn IsReadOnly="True" Header="Linked Tree Name" Visibility="Collapsed" Binding="{Binding LinkedTreeName}" />
      </DataGrid.Columns>
    </DataGrid>
  </Grid>
</UserControl>