<UserControl x:Class="StatisticsV"
             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:StatisticsV}}}"
                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}">
         <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">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
         </Grid.ColumnDefinitions>
         <StackPanel Grid.Row="1">
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLTotParts_Msg}"/>
               <TextBlock Text="{Binding Tag.sBTLTotParts,
                                   RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:StatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLTotVolume_Msg}"/>
               <TextBlock Text="{Binding Tag.sBTLTotVolume,
                                   RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:StatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLTotTime_Msg}"/>
               <TextBlock Text="{Binding Tag.sBTLTotTime,
                                   RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:StatisticsV}}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
               <TextBlock Text="{Binding BTLRemainingTime_Msg}"/>
               <TextBlock Text="{Binding Tag.sBTLRemainingTime,
                                   RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:StatisticsV}}}"/>
            </StackPanel>
         </StackPanel>
         <Button Grid.Column="1"
                 ToolTip="{Binding CopyToClipboard_Msg}"
                 x:Name="CopyToClipboardBtn"
                 Style="{StaticResource ToolBar_Button}">
            <Image Source="/Resources/Statistics/CopyToClipboard.png" Stretch="Uniform"/>
         </Button>
         <Button Grid.Column="2"
                 ToolTip="{Binding PrintPDF_Msg}"
                 Command="{Binding PrintPDF_Command}"
                 Style="{StaticResource ToolBar_Button}">
            <Image Source="/Resources/Statistics/PrintPDF.png" Stretch="Uniform"/>
         </Button>
      </Grid>
   </Grid>

</UserControl>
