<UserControl x:Class="OnlyProdStatisticsV"
             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>
      <EgtBEAMWALLCORE:EgtDataGrid x:Name="dgStatistics"
                                   ItemsSource="{Binding Tag.BTLPartVMList,
                                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdStatisticsV}}}"
                                   CanUserAddRows="False"
                                   AutoGenerateColumns="False"
                                   CanUserResizeRows="False"
                                   SelectionMode="Extended"
                                   ScrollViewer.CanContentScroll="True" 
                                   ScrollViewer.VerticalScrollBarVisibility="Auto"
                                   ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                   Margin="0,0,0,5"
                                   BindingColumns="{Binding StatisticsColumns}"
                                   AlternatingRowBackground="{StaticResource BeamWall_LinkWater}"
                                   AlternationCount="2"
                                   ColumnHeaderBackground="{StaticResource BeamWall_Teal}"
                                   ColumnHeaderForeground="{StaticResource BeamWall_White}"
                                   ColumnHeaderHorizontalContentAlignment="Center"
                                   ColumnHeaderFontWeight="Bold"
                                   ColumnHeaderFontSize="15"
                                   ColumnHeaderPadding="0,2,0,2"
                                   CellStyle="{StaticResource CellDataGrid_CustomHighLight}"
                                   RowStyle="{StaticResource RowDataGrid_CustomHighLight}"
                                   Style="{StaticResource DataGrid_OnlyProd}">
         <DataGrid.Resources>
            <!--PDN - Nome-->
            <DataGridTextColumn x:Key="colPDN" Binding="{Binding nPDN}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.PDN_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--W - Larghezza-->
            <DataGridTextColumn x:Key="colW" Binding="{Binding sW}" SortMemberPath="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 sH}" SortMemberPath="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 sL}" SortMemberPath="dL">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.L_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--NAM - Descrizione-->
            <DataGridTextColumn x:Key="colDESC" Binding="{Binding sNAM}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.NAM_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>
            <!--CNT - Richiesti da BTL-->
            <DataGridTextColumn x:Key="colCNT" Binding="{Binding sCNT}" SortMemberPath="nCNT">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.CNT_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--ADDED - Aggiunti-->
            <DataGridTextColumn x:Key="colADDED" Binding="{Binding sADDED}" SortMemberPath="nADDED">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.ADDED_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--INPROD - IN OTTIMIZZAZIONE-->
            <DataGridTextColumn x:Key="colINPROD" Binding="{Binding nINPROD}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.INPROD_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--DONE - PRODOTTI-->
            <DataGridTextColumn x:Key="colDONE" Binding="{Binding nDONE}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.DONE_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--UNITVOLUME - VOLUME UNITARIO-->
            <DataGridTextColumn x:Key="colUNITVOLUME" Binding="{Binding sUnitVolume}" SortMemberPath="dUnitVolume">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.UNIT_VOLUME_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>
            <!--TOTVOLUME - VOLUME TOTALE-->
            <DataGridTextColumn x:Key="colTOTVOLUME" Binding="{Binding sTotVolume}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.TOT_VOLUME_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>
            <!--CALCTIME - TEMPO TOTALE STIMATO-->
            <DataGridTextColumn x:Key="colTOTTIME" Binding="{Binding sTotTime}">
               <DataGridTextColumn.HeaderTemplate>
                  <DataTemplate>
                     <TextBlock Text="{Binding Path=DataContext.TOT_TIME_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                  </DataTemplate>
               </DataGridTextColumn.HeaderTemplate>
            </DataGridTextColumn>

         </DataGrid.Resources>

      </EgtBEAMWALLCORE:EgtDataGrid>

      <Grid Grid.Row="1" Background="{StaticResource BeamWall_Glacier}">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
         </Grid.ColumnDefinitions>
         <StackPanel>
            <StackPanel Orientation="Horizontal" Margin="10,10,0,0" Background="{StaticResource BeamWall_White}">
               <TextBlock Text="{Binding BTLTotParts_Msg}" Margin="10,5,5,5"/>
               <TextBlock Text="{Binding Tag.sBTLTotParts,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdStatisticsV}}}"
                          Margin="10,5,5,5"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="10,-1,0,0" Background="{StaticResource BeamWall_White}">
               <TextBlock Text="{Binding BTLTotVolume_Msg}" Margin="10,5,5,5"/>
               <TextBlock Text="{Binding Tag.sBTLTotVolume,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdStatisticsV}}}"
                          Margin="10,5,5,5"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="10,-1,0,0" Background="{StaticResource BeamWall_White}">
               <TextBlock Text="{Binding BTLTotTime_Msg}" Margin="10,5,5,5"/>
               <TextBlock Text="{Binding Tag.sBTLTotTime,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdStatisticsV}}}"
                          Margin="10,5,5,5"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="10,-1,0,10" Background="{StaticResource BeamWall_White}">
               <TextBlock Text="{Binding BTLRemainingTime_Msg}" Margin="10,5,5,5"/>
               <TextBlock Text="{Binding Tag.sBTLRemainingTime,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdStatisticsV}}}"
                          Margin="10,5,5,5"/>
            </StackPanel>
         </StackPanel>
         <StackPanel Grid.Column="1" Orientation="Vertical" Margin="0,10,10,10" Background="{StaticResource BeamWall_White}">
         <Button ToolTip="{Binding CopyToClipboard_Msg}"
                 x:Name="CopyToClipboardBtn"
                 Style="{StaticResource CopyToClipboard_ToolBar_Button}"
                 Margin="0,10,10,10">
            <Image Source="/Resources/Statistics/CopyToClipboard.png" Stretch="Uniform"/>
         </Button>
            <Button ToolTip="{Binding PrintPDF_Msg}"
                    Command="{Binding PrintPDF_Command}"
                    Style="{StaticResource CopyToClipboard_ToolBar_Button}"
                    Margin="0,10,10,10">
               <Image Source="/Resources/Statistics/PrintPDF.png" Stretch="Uniform"/>
            </Button>
         </StackPanel>
      </Grid>
   </Grid>

</UserControl>
