<Window x:Class="WpfApplication19.RLWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:c="clr-namespace:WpfApplication19"
        Title="RLWindow" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="514" Width="880" Loaded="Window_Loaded">
    <Window.Resources>
        <c:NameConverter x:Key="myNameConverter"/>
        <Style TargetType="{x:Type DataGridCell}">
            <Style.Triggers>
                <Trigger Property="DataGridCell.IsFocused" Value="True">
                    <Setter Property="Background" Value="#ff0000" />
                </Trigger>

            </Style.Triggers>
            <Setter Property="FontSize" Value="20" />

        </Style>
    </Window.Resources>
    <Grid>
        
        <ToolBarTray Height="36" HorizontalAlignment="Left" Margin="12,115,0,0" Name="toolBarTray2" VerticalAlignment="Top" Width="839">
            <ToolBar>
                <Button Padding="10,2" Name="addRow" Click="addRow_Click" Margin="3,0" BorderBrush="#FF0D6AFF" BorderThickness="1">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/add_row.png" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc AddRow}"/>
                    </StackPanel>
                </Button>
                <Button Padding="10,2" Name="addMeasureColumn" Click="addMeasureColumn_Click" BorderBrush="#FF0D6AFF" BorderThickness="1" Margin="3,0">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/add_column_icon.jpg" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc AddColumn}"/>
                    </StackPanel>
                </Button>
                <Button Padding="10,2" Name="removeMeasureColumn" Click="removeMeasureColumn_Click" Margin="3,0" BorderThickness="1" BorderBrush="#FF0D6AFF">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/add_column_icon.jpg" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc RemoveCol}"/>
                    </StackPanel>
                </Button>
                <Button Padding="10,2" Name="addMiddleBtn" Click="addMiddleBtn_Click" Margin="3,0" BorderBrush="#FF0D6AFF" BorderThickness="1">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/table_row_insert.png" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc AddMiddle}" Name="middleText" />
                    </StackPanel>
                </Button>
                <Button Padding="10,2" Name="addInBtn" Click="addInBtn_Click" Margin="3,0" BorderBrush="#FF0D6AFF" BorderThickness="1">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/table_row_insert.png" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc AddIn}" Name="inText" />
                    </StackPanel>
                </Button>
                <Button Padding="10,2" Name="deleteData" Click="deleteData_Click" Margin="3,0" BorderBrush="#FF0D6AFF" BorderThickness="1">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/Delete.png" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc Delete}"/>
                    </StackPanel>
                </Button>
                <Button Padding="10,2" Name="saveCellBtn" Click="saveCellBtn_Click" Margin="3,0" BorderBrush="#FF0D6AFF">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/Actions-file-save-as-icon.png" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc Save}"/>
                    </StackPanel>
                </Button>
                <Button Padding="10,2" Name="printBtn" Click="printBtn_Click" Margin="3,0" BorderBrush="#FF0D6AFF" BorderThickness="2">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/WpfApplication19;component/Images/Print.png" Width="20"></Image>
                        <TextBlock Padding="3" Text="{Loc Print}"/>
                    </StackPanel>
                </Button>
            </ToolBar>
        </ToolBarTray>
        <DataGrid  AutoGenerateColumns="False" CanUserAddRows="False" HorizontalAlignment="Left" Name="measureGrid" VerticalAlignment="Top" RowEditEnding="measureGrid_RowEditEnding" KeyUp="measureGrid_KeyUp" CellEditEnding="measureGrid_CellEditEnding" LostFocus="measureGrid_LostFocus" LostKeyboardFocus="measureGrid_LostKeyboardFocus" LoadingRow="measureGrid_LoadingRow" BeginningEdit="measureGrid_BeginningEdit" SelectedCellsChanged="measureGrid_SelectedCellsChanged" CurrentCellChanged="measureGrid_CurrentCellChanged" MinHeight="200" Width="844" KeyDown="measureGrid_KeyDown" Loaded="measureGrid_Loaded" SourceUpdated="measureGrid_SourceUpdated" VerticalScrollBarVisibility="Visible" IsEnabled="True" Height="270" Margin="7,157,0,0" ColumnDisplayIndexChanged="measureGrid_ColumnDisplayIndexChanged" PreviewKeyDown="measureGrid_PreviewKeyDown" SelectedIndex="-1" RowBackground="#FFDBD5D5">


            <DataGrid.Columns>
                <DataGridTextColumn Header="FA1/FA2" IsReadOnly="True" CanUserSort="False">
                    <DataGridTextColumn.Binding>
                        <MultiBinding Converter="{StaticResource myNameConverter}">
                            <Binding Path="Count"/>
                            <Binding Path="Type"/>
                        </MultiBinding>
                    </DataGridTextColumn.Binding>


                </DataGridTextColumn>


                <DataGridTextColumn Header="1"  Binding="{Binding P1, StringFormat=0.00}"  Width="*" IsReadOnly="True" CanUserSort="False"  />


                <DataGridTextColumn Header="2"  Binding="{Binding P2, StringFormat=0.00}"  Width="*" IsReadOnly="True" CanUserSort="False"/>
                <DataGridTextColumn Header="3"  Binding="{Binding P3, StringFormat=0.00}"  Width="*" IsReadOnly="True" CanUserSort="False"/>
                <DataGridTextColumn Header="4"  Binding="{Binding P4, StringFormat=0.00}" Visibility="Hidden" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="5"  Binding="{Binding P5, StringFormat=0.00}" Visibility="Hidden" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="6"  Binding="{Binding P6, StringFormat=0.00}" Visibility="Hidden" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="7"  Binding="{Binding P7, StringFormat=0.00}" Visibility="Hidden" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="8"  Binding="{Binding P8, StringFormat=0.00}" Visibility="Hidden" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="9"  Binding="{Binding P9, StringFormat=0.00}" Visibility="Hidden" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="10"  Binding="{Binding P10, StringFormat=0.00}" Visibility="Hidden" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="{Loc Average}"  Binding="{Binding Avg, StringFormat=0.00}" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="{Loc Grade}"  Binding="{Binding Grade}" IsReadOnly="True" Width="*" CanUserSort="False"/>
                <DataGridTextColumn Header="{Loc ResultGrade}"  Binding="{Binding ResultGrade}" IsReadOnly="True" Width="*" CanUserSort="False" Visibility="Hidden" />
            </DataGrid.Columns>
            <DataGrid.RowHeaderTemplate>
                <DataTemplate>

                    <TextBlock>
                        <!--
                    <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, 
                                      AncestorType={x:Type DataGridRow}}, 
                                      Path=Item.Count}"/>
                    -
                    <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, 
                                      AncestorType={x:Type DataGridRow}}, 
                                      Path=Item.Type}"/>
                        -->
                        >>
                    </TextBlock>
                </DataTemplate>
            </DataGrid.RowHeaderTemplate>
        </DataGrid>
        <ToolBar Margin="12,433,217,0" Height="30" VerticalAlignment="Top">

            <Button  Padding="10,2" Name="commitBtn" Click="commitBtn_Click" BorderBrush="#FF0D6AFF" Margin="2,0">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/WpfApplication19;component/Images/commit.png" Width="20"></Image>
                    <TextBlock Padding="3" Text="{Loc Commit}"/>
                </StackPanel>
            </Button>
            <Button  Padding="10,2" Name="undoBtn" Click="undoBtn_Click" BorderBrush="#FF0D6AFF" Margin="2,0">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/WpfApplication19;component/Images/Undo.png" Width="20"></Image>
                    <TextBlock Padding="3" Text="{Loc Undo}"/>
                </StackPanel>
            </Button>
        </ToolBar>
        <Label Content="{Loc LotNo}" Height="28" HorizontalAlignment="Left" Margin="12,20,0,0" Name="label1" VerticalAlignment="Top" />
        <TextBox Height="23" HorizontalAlignment="Right" Margin="0,24,649,0" Name="lotNo" Style="{DynamicResource SimpleTextBox}" VerticalAlignment="Top" Width="142" />
        <Button Height="34" HorizontalAlignment="Left" Margin="229,21,0,0" Name="find" Style="{DynamicResource SimpleButton}" VerticalAlignment="Top" Width="107" Click="find_Click">
            <StackPanel Height="27" Orientation="Horizontal" Width="79">
                <Image Source="/WpfApplication19;component/Images/search.png" />
                <TextBlock FontSize="16" FontWeight="Bold" Padding="5" Text="{Loc Find}" VerticalAlignment="Center" />
            </StackPanel>
        </Button>
        <Label Content="RL Standard" Height="28" Margin="0,81,748,0" Name="label2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="92" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="121,82,0,0" Name="RLMin" VerticalAlignment="Top" Width="120" Text="" TextChanged="RLMin_TextChanged" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="290,81,0,0" Name="RLMax" VerticalAlignment="Top" Width="120" Text="" TextChanged="RLMax_TextChanged" />
        <Label Content="-" Height="28" HorizontalAlignment="Left" Margin="254,81,0,0" Name="label3" VerticalAlignment="Top" />
        <Label Content="Reading &gt;&gt;" Height="28" HorizontalAlignment="Left" Margin="711,24,0,0" Name="label16" VerticalAlignment="Top" Width="83" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="795,29,0,0" Name="cellIndicattor" Text="(Row,Col)" VerticalAlignment="Top" />
        <TextBlock Background="Black" FontSize="35" Foreground="Red" Height="51" HorizontalAlignment="Left" Margin="715,52,0,0" Name="readingBox" Padding="0" Style="{DynamicResource SimpleButtonFocusVisual}" Text="0.00" TextAlignment="Center" VerticalAlignment="Top" Width="132" />
    </Grid>
    
</Window>
