<UserControl x:Class="RawPartListV"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:EgtBEAMWALL="clr-namespace:EgtBEAMWALL.Supervisor"
             xmlns:EgtBEAMWALLCORE="clr-namespace:EgtBEAMWALL.Core;assembly=EgtBEAMWALL.Core">
   <!--<ToggleButton IsChecked="{Binding DataContext.bL_IsReadOnly, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>-->
   <EgtBEAMWALLCORE:EgtDataGrid x:Name="MachGroupDataGrid"
                                ItemsSource="{Binding Tag.MachGroupVMList_View,
                                                      RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
                                SelectedItem="{Binding Tag.SelectedMachGroup,
                                                       RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"
                                IsSynchronizedWithCurrentItem="True"
                                AutoGenerateColumns="False"
                                CanUserDeleteRows="False"
                                CanUserResizeRows="False"
                                SelectionMode="Single"
                                ScrollViewer.CanContentScroll="True" 
                                ScrollViewer.VerticalScrollBarVisibility="Auto"
                                ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                Margin="0,0,0,5"
                                BindingColumns="{Binding RawPartColumns}"
                                Sorting="MachGroupVMList_Sorting"
                                Style="{StaticResource DataGrid_CustomHighLight}">
      <DataGrid.Resources>
         <!--ID - Id gruppo-->
         <DataGridTextColumn x:Key="colNAME" Binding="{Binding Name}" SortMemberPath="nName">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.ID_Msg, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <DataGridTemplateColumn x:Key="colPRODUCE">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Button ToolTip="P"
                          Command="{Binding ProduceMachGroup_Command}"
                          IsEnabled="{Binding Produce_IsEnabled}"
                          Style="{StaticResource LeftPanel_SmallButton}">
                     <Image Source="/Resources/RawPartList/Produce.png" Stretch="Uniform"/>
                  </Button>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <!--Validità pezzo-->
         <DataGridTemplateColumn x:Key="colCALC">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Border Background="{Binding Calc_Background}"/>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <!--Stato di produzione-->
         <DataGridTemplateColumn x:Key="colPRODUCTION">
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <Border Background="{Binding Production_Background}"/>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <!--STARTCUT - Ritaglio iniziale-->
         <DataGridTextColumn x:Key="colSTARTCUT" Binding="{Binding sStartCut}" SortMemberPath="dStartCut">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.StartOffset_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!--W - Larghezza-->
         <DataGridTextColumn x:Key="colW" Binding="{Binding dW}">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.W_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!--H - Altezza-->
         <DataGridTextColumn x:Key="colH" Binding="{Binding dH}">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.H_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!--L - Lunghezza-->
         <DataGridTextColumn x:Key="colL" Binding="{Binding dL}">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.L_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!--PosZ - Posizione in Z-->
         <DataGridTextColumn x:Key="colPOSZ" Binding="{Binding sPosZ}">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.PosZ_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!--MAT - Materiale-->
         <DataGridTextColumn x:Key="colMATERIAL" Binding="{Binding sMATERIAL}">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.Material_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!--% - % utilizzo-->
         <DataGridTextColumn x:Key="colUSAGE" Binding="{Binding sUsage}" SortMemberPath="dUsage">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.Used_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
         <!--S - Scarti-->
         <DataGridTextColumn x:Key="colWASTE" Binding="{Binding sWaste}" SortMemberPath="dWaste">
            <DataGridTextColumn.Header>
               <TextBlock Text="{Binding Path=DataContext.Waste_Msg,
                                         RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:RawPartListV}}}"/>
            </DataGridTextColumn.Header>
         </DataGridTextColumn>
      </DataGrid.Resources>
      <DataGrid.RowStyle>
         <Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
            <Setter Property="Background" Value="{Binding Production_Background}"/>
            <EventSetter Event="PreviewMouseDown" Handler="RawPartRow_PreviewMouseDown"/>
         </Style>
      </DataGrid.RowStyle>

   </EgtBEAMWALLCORE:EgtDataGrid>

</UserControl>
