<UserControl x:Class="OnlyProdPParameterListV"
             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">

   <EgtBEAMWALLCORE:EgtDataGrid CanUserDeleteRows="False"
                                SelectionMode="Single"
                                Margin="0,0,0,5"
                                ItemsSource="{Binding Tag.PBTLParamVMList, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdPParameterListV}}}"
                                SelectedItem="{Binding Tag.SelPBTLParam, RelativeSource={RelativeSource AncestorType={x:Type EgtBEAMWALL:OnlyProdPParameterListV}}}"
                                IsEnabled="{Binding PParameterList_IsEnabled}"    
                                BindingColumns="{Binding PParameterListColumns}"
                                AlternatingRowBackground="{StaticResource BeamWall_LinkWater}"
                                AlternationCount="2"
                                ColumnHeaderBackground="{StaticResource BeamWall_Downy}"
                                ColumnHeaderForeground="{StaticResource BeamWall_White}"
                                ColumnHeaderHorizontalContentAlignment="Center"
                                ColumnHeaderFontWeight="Bold"
                                ColumnHeaderFontSize="15"
                                ColumnHeaderPadding="0,2,0,2"
                                CellStyle="{StaticResource CellDataGrid_CustomHighLight}"
                                Style="{StaticResource DataGrid_OnlyProd}">
      <DataGrid.RowStyle>
         <Style TargetType="DataGridRow" BasedOn="{StaticResource RowDataGrid_CustomHighLight}">
            <EventSetter Event="PreviewMouseDown" Handler="PParameterList_PreviewMouseDown"/>
         </Style>
      </DataGrid.RowStyle>

      <DataGrid.Resources>
         <EgtBEAMWALL:TrimmedTextBlockVisibilityConverter x:Key="TrimToVisConverter" />
         <!--Custom-->
         <DataGridTemplateColumn x:Key="colCUSTOM">
            <DataGridTemplateColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding DataContext.Custom_Msg, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTemplateColumn.HeaderTemplate>
            <DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                  <CheckBox IsChecked="{Binding bCustom, UpdateSourceTrigger=PropertyChanged}"
                            Visibility="{Binding Tag, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                            VerticalAlignment="Center"/>
               </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
         </DataGridTemplateColumn>
         <!--Nome-->
         <DataGridTextColumn x:Key="colNAME"  Binding="{Binding sName}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.NAM_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <!--Descrizione-->
         <DataGridTextColumn x:Key="colDESC" Binding="{Binding sDescription}">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Description_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
            <DataGridTextColumn.CellStyle>
               <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource CellDataGrid_CustomHighLight}">
                  <Setter Property="Template">
                     <Setter.Value>
                        <ControlTemplate TargetType="{x:Type DataGridCell}">
                           <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}"
                                      Style="{StaticResource OnlyProd_TextBlock}">
                              <TextBlock.ToolTip>
                                 <ToolTip Style="{StaticResource OnlyProd_ToolTip}">
                                    <ToolTip.Content>
                                       <StackPanel Orientation="Vertical">
                                          <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}"/>
                                          <Image Source="{Binding sDrawPath}" 
                                                 Style="{StaticResource OnlyProdFeatureList_Image}"/>
                                       </StackPanel>
                                    </ToolTip.Content>
                                 </ToolTip>
                              </TextBlock.ToolTip>
                           </TextBlock>
                        </ControlTemplate>
                     </Setter.Value>
                  </Setter>
               </Style>
            </DataGridTextColumn.CellStyle>
            <DataGridTextColumn.EditingElementStyle>
               <Style TargetType="{x:Type TextBox}">
                  <Setter Property="FontWeight" Value="Bold" />
                  <Setter Property="Foreground" Value="{StaticResource BeamWall_White}" />
                  <Setter Property="Background" Value="{StaticResource BeamWall_FountainBlue}" />
               </Style>
            </DataGridTextColumn.EditingElementStyle>
         </DataGridTextColumn>
         <!--Valore-->
         <DataGridTextColumn x:Key="colVALUE" Binding="{Binding sValue}" SortMemberPath="dValue">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Value_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
            <DataGridTextColumn.EditingElementStyle>
               <Style TargetType="{x:Type TextBox}">
                  <Setter Property="FontWeight" Value="Bold" />
                  <Setter Property="Foreground" Value="{StaticResource BeamWall_White}" />
                  <Setter Property="Background" Value="{StaticResource BeamWall_FountainBlue}" />
               </Style>
            </DataGridTextColumn.EditingElementStyle>
         </DataGridTextColumn>
         <!--Minimo-->
         <DataGridTextColumn x:Key="colMIN" Binding="{Binding sMin}" SortMemberPath="dMin">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Min_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
         <!--Massimo-->
         <DataGridTextColumn x:Key="colMAX" Binding="{Binding sMax}" SortMemberPath="dMax">
            <DataGridTextColumn.HeaderTemplate>
               <DataTemplate>
                  <TextBlock Text="{Binding Path=DataContext.Max_Msg,RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
               </DataTemplate>
            </DataGridTextColumn.HeaderTemplate>
         </DataGridTextColumn>
      </DataGrid.Resources>

   </EgtBEAMWALLCORE:EgtDataGrid>

</UserControl>
