<UserControl x:Class="OptimizerStatisticsV"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.ViewerOptimizer" 
             xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="1*"/>
         <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>
      <TabControl SelectedIndex="{Binding SelStatisticsTab}">
         <TabControl.ItemContainerStyle>
            <Style TargetType="{x:Type TabItem}">
               <Setter Property="Visibility" Value="Collapsed"/>
            </Style>
         </TabControl.ItemContainerStyle>

         <TabItem Header="OPTIMIZERSTATS">
            <TabItem.Content>
               <EgtBEAMWALLCORE:EgtDataGrid x:Name="dgOptimizerStatistics"
                ItemsSource="{Binding Tag.MachGroupPanelVM.MachGroupVMList,
                                      RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"
                CanUserAddRows="False"
                AutoGenerateColumns="False"
                CanUserResizeRows="False"
                SelectionMode="Extended"
                ScrollViewer.CanContentScroll="True" 
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                Margin="0,0,0,5"
                BindingColumns="{Binding OptimizerStatisticsColumns}">
                  <DataGrid.Resources>
                     <!--Id - Nome-->
                     <DataGridTextColumn x:Key="colNAME" Binding="{Binding Name}" SortMemberPath="nName">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.ID_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--W - Larghezza-->
                     <DataGridTextColumn x:Key="colW" Binding="{Binding dW}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.W_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--H - Altezza-->
                     <DataGridTextColumn x:Key="colH" Binding="{Binding dH}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.H_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--L - Lunghezza-->
                     <DataGridTextColumn x:Key="colL" Binding="{Binding dL}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.L_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--MAT - Materiale-->
                     <DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding sMATERIAL}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.MAT_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--% - % utilizzo-->
                     <DataGridTextColumn x:Key="colUSAGE" Binding="{Binding sUsage}" SortMemberPath="dUsage">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.Used_Msg,
                                               RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--S - Scarti-->
                     <DataGridTextColumn x:Key="colWASTE" Binding="{Binding sWaste}" SortMemberPath="dWaste">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.Waste_Msg,
                                               RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--CALCTIME - TEMPO UNITARIO STIMATO-->
                     <DataGridTextColumn x:Key="colUNITTIME" Binding="{Binding sUnitTime}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.UNIT_TIME_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>

                  </DataGrid.Resources>

               </EgtBEAMWALLCORE:EgtDataGrid>
            </TabItem.Content>
         </TabItem>

         <TabItem Header="RAWPARTSTAT">
            <TabItem.Content>
               <EgtBEAMWALLCORE:EgtDataGrid x:Name="dgRawPartStatistics"
                ItemsSource="{Binding RawPartList}"
                CanUserAddRows="False"
                AutoGenerateColumns="False"
                CanUserResizeRows="False"
                SelectionMode="Extended"
                ScrollViewer.CanContentScroll="True" 
                ScrollViewer.VerticalScrollBarVisibility="Auto"
                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                Margin="0,0,0,5"
                BindingColumns="{Binding RawPartStatisticsColumns}">
                  <DataGrid.Resources>
                     <!--W - Larghezza-->
                     <DataGridTextColumn x:Key="colW" Binding="{Binding sW}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.W_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--H - Altezza-->
                     <DataGridTextColumn x:Key="colH" Binding="{Binding sH}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.H_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--L - Lunghezza-->
                     <DataGridTextColumn x:Key="colL" Binding="{Binding sL}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.L_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--MAT - Materiale-->
                     <DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding sMaterial}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.MAT_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>
                     <!--QTY - Quantita'-->
                     <DataGridTextColumn x:Key="colQTY" Binding="{Binding nQuantity, Mode=TwoWay}">
                        <DataGridTextColumn.HeaderTemplate>
                           <DataTemplate>
                              <TextBlock Text="{Binding Path=DataContext.QTY_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                           </DataTemplate>
                        </DataGridTextColumn.HeaderTemplate>
                     </DataGridTextColumn>

                  </DataGrid.Resources>

               </EgtBEAMWALLCORE:EgtDataGrid>
            </TabItem.Content>
         </TabItem>

      </TabControl>

      <Grid Grid.Row="1">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
         </Grid.ColumnDefinitions>
         <StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding TotMachGroups_Msg}"/>
               <TextBlock Text="{Binding Tag.MachGroupPanelVM.sTotMachGroups,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLTotVolume_Msg}"/>
               <TextBlock Text="{Binding Tag.MachGroupPanelVM.sTotVolume,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLTotEstimatedTime_Msg}"/>
               <TextBlock Text="{Binding Tag.MachGroupPanelVM.sTotEstimatedTime,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLTotTime_Msg}"/>
               <TextBlock Text="{Binding Tag.MachGroupPanelVM.sTotTime,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLRemainingTime_Msg}"/>
               <TextBlock Text="{Binding Tag.MachGroupPanelVM.sRemainingTime,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
         </StackPanel>
         <StackPanel Grid.Column="1">
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding TotCNTParts_Msg}"/>
               <TextBlock Text="{Binding Tag.BTLStructureVM.sTotCNTParts,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding TotADDEDParts_Msg}"/>
               <TextBlock Text="{Binding Tag.BTLStructureVM.sTotADDEDParts,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding TotINPRODParts_Msg}"/>
               <TextBlock Text="{Binding Tag.BTLStructureVM.sTotINPRODParts,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding TotDONEParts_Msg}"/>
               <TextBlock Text="{Binding Tag.BTLStructureVM.sTotDONEParts,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OptimizerStatisticsV}}}"/>
            </StackPanel>
         </StackPanel>
         <ToggleButton Content="R"
                       Grid.Column="2"
                       IsChecked="{Binding bRawPart_IsChecked}"
                       ToolTip="Materials"
                       Style="{StaticResource ToolBar_ToggleButton}">
            <!--<Image Source="/Resources/Statistics/CopyToClipboard.png" Stretch="Uniform"/>-->
         </ToggleButton>
         <Button Grid.Column="3"
                 ToolTip="{Binding CopyToClipboard_Msg}"
                 x:Name="CopyToClipboardBtn"
                 Style="{StaticResource ToolBar_Button}">
            <Image Source="/Resources/Statistics/CopyToClipboard.png" Stretch="Uniform"/>
         </Button>
         <Button Grid.Column="4"
                 ToolTip="{Binding PrintPDF_Msg}"
                 Command="{Binding PrintPDF_Command}"
                 Style="{StaticResource ToolBar_Button}">
            <Image Source="/Resources/Statistics/PrintPDF.png" Stretch="Uniform"/>
         </Button>
      </Grid>
   </Grid>

</UserControl>
